New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce `wp cli has-command` to detect whether a command is registered #4349

Merged
merged 11 commits into from Sep 26, 2017

Conversation

4 participants
@Sidsector9
Member

Sidsector9 commented Sep 13, 2017

I've created a recursive function that traverses the array of the dump output by self::command_to_array( WP_CLI::get_root_command() )

See #4283

  • Tested locally
  • Functional tests

@Sidsector9 Sidsector9 requested review from schlessera, danielbachhuber and wp-cli/committers Sep 13, 2017

Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
@schlessera

This comment has been minimized.

Show comment
Hide comment
@schlessera

schlessera Sep 14, 2017

Member

Looks good so far.

A general note:
wp is not actually part of the command name, it is the name of the executable that was used to start up the WP-CLI framework. So, something like wp post list could just as well be php ~/wp-cli.phar post list.

As regards to testing, you could go through the following steps:

  • check whether the command scaffold package can be found - this should return an error, as the command is not part of the bundled commands
  • install the wp-cli/scaffold-package-command
  • check again whether the command scaffold package can be found - this time it should be positive
Member

schlessera commented Sep 14, 2017

Looks good so far.

A general note:
wp is not actually part of the command name, it is the name of the executable that was used to start up the WP-CLI framework. So, something like wp post list could just as well be php ~/wp-cli.phar post list.

As regards to testing, you could go through the following steps:

  • check whether the command scaffold package can be found - this should return an error, as the command is not part of the bundled commands
  • install the wp-cli/scaffold-package-command
  • check again whether the command scaffold package can be found - this time it should be positive

@schlessera schlessera added this to the 1.4.0 milestone Sep 14, 2017

@danielbachhuber

👍 Looking good, some minor nits.

Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
* <command_name>...
* : The command
*
* ## EXAMPLES

This comment has been minimized.

@danielbachhuber

danielbachhuber Sep 15, 2017

Member

Needs another space after this heading.

@danielbachhuber

danielbachhuber Sep 15, 2017

Member

Needs another space after this heading.

Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
@Sidsector9

This comment has been minimized.

Show comment
Hide comment
@Sidsector9

Sidsector9 Sep 15, 2017

Member

Made changes as per review

Member

Sidsector9 commented Sep 15, 2017

Made changes as per review

Show outdated Hide outdated features/cli.feature Outdated
Show outdated Hide outdated php/commands/src/CLI_Command.php Outdated
Show outdated Hide outdated features/cli.feature Outdated

@danielbachhuber danielbachhuber changed the title from GH#4283 Function to detect a registered WP-CLI command to Introduce `wp cli has-command` to detect whether a command is registered Sep 19, 2017

@danielbachhuber danielbachhuber self-requested a review Sep 26, 2017

@schlessera schlessera merged commit 4738303 into wp-cli:master Sep 26, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment