So you've got an awesome idea to throw into WP-CLI. Great! Please keep the following in mind:
- The best way to get feedback is by opening an issue or a pull request; if you think the code shouldn't be merged yet, just say so.
- If you're adding a new command or subcommand, please consider adding a functional test for it in the
features
directory. Also, please create the appropriate.txt
file in theman-src
directory. - Please follow the WordPress Coding Standards.
To generate a man page, WP-CLI looks for .txt
files in the man-src
directory. It also gathers information from the inline comments and the @synopsis
annotations.
The compiled man page is placed in the man
directory.
To (re)generate one or more man pages, you first need to have the ronn ruby gem installed.
Then, you can run one of the following:
wp --man
- regenerates all man pageswp core --man
- regenerates man pages for thecore
commandwp core download --man
- regenerates man page only for thecore download
subcommand
There are two types of tests:
All the test dependencies can be installed using Composer:
php composer.phar install --dev
Before running the tests, you'll need a MySQL user called wp_cli_test
with the
password password1
that has full privileges on the MySQL database wp_cli_test
.
Running the following as root in MySQL should do the trick:
GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1";
Finally, to run the tests:
vendor/bin/phpunit
vendor/bin/behat
Thanks! Hacking on WP-CLI should be fun. If you find any of this hard to figure out, let us know so we can improve our process or documentation!