Add a real-world example for `wp cli has-command` by austinginder · Pull Request #5908 · wp-cli/wp-cli
Expand Up
@@ -615,6 +615,14 @@ private function get_update_type_str( $assoc_args ) {
* $ echo $?
* 1
*
* # Install a WP-CLI package if not already installed
* $ if ! $(wp cli has-command doctor); then wp package install wp-cli/doctor-command; fi
* Installing package wp-cli/doctor-command (dev-main || dev-master || dev-trunk)
* Updating /home/person/.wp-cli/packages/composer.json to require the package...
* Using Composer to install the package...
* ---
* Success: Package installed.
*
* @subcommand has-command
*
* @when after_wp_load
Expand Down