Skip to content

Commit 4c68c26

Browse files
authored
Update Docs CLI_Command.php (#5908)
* Update Docs CLI_Command.php Adds an one-liner example to documentation showing a real world example of `wp cli has-command`. * Fix whitespace
1 parent e516414 commit 4c68c26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

php/commands/src/CLI_Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ private function get_update_type_str( $assoc_args ) {
615615
* $ echo $?
616616
* 1
617617
*
618+
* # Install a WP-CLI package if not already installed
619+
* $ if ! $(wp cli has-command doctor); then wp package install wp-cli/doctor-command; fi
620+
* Installing package wp-cli/doctor-command (dev-main || dev-master || dev-trunk)
621+
* Updating /home/person/.wp-cli/packages/composer.json to require the package...
622+
* Using Composer to install the package...
623+
* ---
624+
* Success: Package installed.
625+
*
618626
* @subcommand has-command
619627
*
620628
* @when after_wp_load

0 commit comments

Comments
 (0)