Version 1.2.0 released

Happy release day!

After 325 merged pull requests, we’re excited to bring you WP-CLI v1.2.0, chock full of enhancements, bug fixes… and a bootstrap refactor.

But first…

We have a new logo!

Coming soon to a laptop near you:

Thanks to Chris Wallace and the crew at Lift UX for their work, as well as everyone who responded to my pings about feedback.

Commands abstracted to distinct packages

We’ve split up the project!

The main wp-cli/wp-cli repository now only contains the framework itself. All of the bundled commands can be found in separate repositories. For instance, the wp cache * series of commands are now located at github.com/wp-cli/cache-command.

This abstraction provides a few benefits:

  • While developing, the tests are only run for the specific component you’re working on, making the feedback loop much shorter.
  • Individual command packages can be controlled and set up independently, opening up the opportunity for better collaboration.
  • Hotfixes and intermediary releases can be published for individual commands, that can then be updated through the built-in package manager.
  • Tests run really fast now.
  • When you submit a pull request, you don’t have to wait two hours for the tests to run.

For those using WP-CLI via Composer, you can contribute improvements to packages as you’d normally contribute to Composer dependencies. Use composer install --prefer-source to install dependencies as Git clones.

For those using WP-CLI via Phar downloadable, you can contribute improvements by installing the package (which will override the bundled version). For instance, with the cache command, this is:

$ wp package install git@github.com:wp-cli/cache-command.git
$ cd $(wp package path wp-cli/cache-command)

Check out #3728 for the original history. For a better understanding of the underlying infrastructure, read Alain’s posts about the new bootstrapping mechanism, managing command dependencies and dependency resolution mechanisms.

Next up: Contribution workflow

The investments in package abstraction and the bootstrap process are a part of our larger effort to improve the contribution workflow.

Ultimately, we’d like to make contributing to the project:

  • Effortless. While understanding the WP-CLI codebase does require a certain technical knowledge, those who can contribute to the codebase should be able to do so with as little overhead as possible.
  • Enjoyable. Making improvements to WP-CLI should be fun and rewarding. For contributors, this means well-defined entry points, sufficient workflow documentation, clearly-articulated vision, roadmap, and decision-making process, and so on.

For new contributors, we now have a Good First Issues page:

For committers, we now have the beginnings of a customized dashboard:

Work on the contribution workflow is an on-going process. We’ve barely scratched the surface.

Expect to see lots efforts on some of the key areas that make up the contributor experience:

  • Articulation of the decision making process for transforming ideas into new commands. We need to identify how we can sustainably transform ideas into maintained packages.
  • Improving the onboarding of new committers through documentation, tools and processes. Read the Committers credo to better understand our expectations.

Join the conversation during our weekly office hours, Tuesday, April 25 at 16:00 UTC, or at WordCamp Europe.

New commands

Want to sanity check your wp-config.php? Use wp config get list constants and globals defined in wp-config.php [#9]

$ wp config get --fields=key,value
+--------------------+-----------------+
| key                | value           |
+--------------------+-----------------+
| table_prefix       | wp_             |

Don’t want to remember where wp-config.php is on your filesystem? Use wp config path to get the path to wp-config.php [#7]

# Edit wp-config.php in your editor.
$ vim $(wp config path)

Curious how much your database weighs? Run wp db size to get the size of the database and its tables [#16]

$ wp db size --tables
+-----------------------+--------+
| Name                  | Size   |
+-----------------------+--------+
| wp_users              | 64 KB  |
| wp_usermeta           | 48 KB  |
| wp_posts              | 4 MB   |
| wp_comments           | 2 MB   |
| wp_links              | 32 KB  |
| wp_options            | 1 MB   |
| wp_postmeta           | 8 MB   |
| wp_terms              | 416 KB |
| wp_term_taxonomy      | 336 KB |
| wp_term_relationships | 736 KB |
| wp_termmeta           | 48 KB  |
| wp_commentmeta        | 2 MB   |
+-----------------------+--------+

Everything else in v1.2.0

Command improvements

  • wp core install:
    • Generates 18 character password for admin user [#4002].
  • wp cron event run:
    • Only runs specified events when $args are passed with --due-now [#11].
  • wp db *:
    • Uses /usr/bin/env mysql instead of mysql when calling MySQL executable [#14].
  • wp db (drop|reset):
    • Presents database name to confirmation prompts for wp db drop and wp db reset commands [#12].
  • wp db export:
    • Adds --exclude_tables=<tables> option when exporting a database [#20].
  • wp db import:
    • Speeds up import process by disabling auto-commit and (unique and foreign) key checks [#3829].
  • wp language core install:
    • Processes --activate flag even when language is already installed [#3851].
  • wp language core (install|uninstall)
    • Permits multiple languages to be installed or uninstalled at the same time [#4, #5].
  • wp media import:
    • Error handling is improved in a variety of ways [#3755].
  • wp media regenerate:
    • Deletes existing PDF preview images upon regeneration [#3824].
    • Fixes media regeneration when an image has a dimension smaller than a registered image size [#5].
    • Adds --image_size=<size> to regenerate a specific image size [#9].
  • wp menu location assign:
    • Increases verbosity and error reporting [#3852].
  • wp package *:
    • Fixes path returned from get_composer_json_path() under Windows [#11].
  • wp plugin install:
    • Disables renaming behavior when installing from GitHub raw ZIP URLs [#3823].
  • wp plugin update:
    • Introduces --minor and --patch flags for limiting updates based on semantic versioning [#13].
    • Displays correct error when plugin fails to update [#3803].
  • wp (plugin|theme) update:
    • Adds --exclude=<name> argument to exclude plugins or themes from updating [#16].
  • wp post term *:
    • Introduces --by=id argument to explicitly handle terms as ids [#3896].
    • Pluralizes messages based on term count [#3898].
  • wp rewrite *:
    • Warns user when managing rewrites with --skip-plugins or --skip-themes, because rewrites may be missing [#3917].
  • wp scaffold (child-theme|_s):
    • Includes a default .editorconfig based on WordPress coding standards [#3902].
  • wp scaffold plugin-tests
    • Variety of improvements to scaffolded .travis.yml and circle.yml [#3919].
    • Caches Composer in scaffolded .travis.yml [#3816].
    • Installs PHPUnit 4.8.* for PHP 5.*, and PHPUnit 5.7.* for everything else [#6].
    • Tests PHP 7 versions in scaffolded circle.yml [#16].
  • wp server:
    • Permits environment variables to define a specific PHP binary [#3868].
  • wp user create:
    • Generates 24 character password for new users [#7].
  • wp user import-csv:
    • Disables core’s email notifications when updating a user [#3904].

Framework enhancements

  • Symfony 3.x components can be used with WP-CLI. We didn’t even need to break backwards-compatibility [#4067].
  • New hooks:
    • before_add_command:<parent command> lets you check runtime requirements before adding a command
    • after_add_command:<parent command> lets you depend on a specific parent command before triggering a given functionality [#4033]
  • Automatic command dependency resolution. If a sub-command depends on a parent command not yet registered, the addition of this sub-command is deferred until the parent is available [#4094].
  • Spelling suggestions. If you mistype a command, WP-CLI will now be smart enough to make suggestions about what you probably wanted to type, and suggest these corrected spellings. This helps with discovery and error resolution. Suggestions are provided for commands, parameters and aliases [#4004, #4008, #4109]
  • Help documentation wordwraps to 80 characters by default. It wordwrapped previously, but inconsistently so it was often broken [#4105].
  • Variety of testing framework improvements:
    • Variables are replaced in subdirectory paths [#4085].
    • Forces RUN_DIR deletion, safely, to ensure Behat doesn’t hang on cleanup [#4112].
    • Terminates all launched background processes in a cross-platform compatible manner [#4074].
    • Only applies @require-wp tags when WP_VERSION isn’t ‘latest’ or ‘nightly’ to ensure full test suite is run in these contexts [#4055].

Contributors to this release (43 total): 1naveengiri, aaemnnosttv, afragen, balbuf, behzod, carl-alberto, CodeProKid, danielbachhuber, davgothic, diablodale, diggy, dnmvisser, fjarrett, flaskboy, geekoun, gitlost, hason, JayWood, jeremyfrady, ka7, kcarwilemiller, lichtscheu, mbovel, MiteshShah, miya0001, Nikschavan, ntwb, petenelson, rahul3883, raquelmsmith, Rarst, ryanshoover, schlessera, Sidsector9, SosyalAlkolik, ssnepenthe, Steveorevo, tfrommen, tillkruss, timdream, trepmal, wp-make-coffee, zacksheppard