WP-CLI Tool is a powerful Command Line Interface (CLI) tool designed to simplify the management of local WordPress sites running on XAMPP. This tool provides commands to automate tasks such as creating, listing, starting, stopping, backing up, and deleting WordPress sites with ease.
- Features
- Prerequisites
- Installation
- Usage
- Directory Structure
- Customization
- Troubleshooting
- Contributing
- License
- Create WordPress Sites: Quickly set up a new WordPress site by downloading WordPress, setting up a database, and configuring the site.
- List Sites: View all WordPress sites present in your XAMPP
htdocs
directory. - Start/Stop XAMPP Services: Manage XAMPP services directly from the CLI.
- Backup Sites: Backup a WordPress site's database with ease.
- Delete Sites: Completely remove a WordPress site, including files and database.
- User-Friendly Prompts: Interactive prompts make managing sites straightforward and intuitive.
Before using this CLI tool, ensure you have the following installed:
- Node.js (version 16 or higher)
- npm (Node.js package manager)
- XAMPP
- MySQL (installed with XAMPP)
- WP-CLI (WordPress CLI)
To install and set up the WP-CLI Tool, follow these steps:
-
Clone the Repository
git clone https://github.com/yourusername/wp-cli-tool.git cd wp-cli-tool
-
Install Dependencies
npm install
-
Link the CLI Tool Globally
npm link
This section provides detailed instructions on how to use each command available in the WP-CLI Tool.
Create a WordPress Site:
```bash
wpcli create
List Existing WordPress Sites
bash wpcli list **Start XAMPP Services**
bash
wpcli start
Stop XAMPP Services
bash wpcli stop **Backup a WordPress Site**
bash
wpcli backup
Delete a WordPress Site
```bash
wpcli delete
The WP-CLI Tool is designed to be flexible and customizable. Here are some ways you can modify the tool to suit your needs:
- Change Default Paths: Modify the htdocsPath in the command files to match your local XAMPP installation path.
- Add Custom Commands: Create new command files in the src/commands/ directory and register them in bin/wpcli.js.
- Update Database Configuration: Adjust dbConfig in src/utils/db.js to use different database credentials.
- Permission Issues: If you encounter permission issues when running commands, try using sudo (Linux/Mac) or ensure you have the necessary permissions (Windows).
- Path Adjustments: Ensure that the paths in the code (e.g., htdocsPath) are correct for your system. Adjust them if necessary.
- WP-CLI Not Found: Make sure WP-CLI is installed globally and is accessible from your terminal. Refer to the WP-CLI installation guide for more details.
-XAMPP Commands Not Executing: Ensure that XAMPP is installed correctly, and the paths in src/utils/xampp.js are accurate for your XAMPP installation.
Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub.