Skip to content

Commit

Permalink
fix error message when fetching help for nested commands (fixes wp-cl…
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoprimo committed Feb 21, 2014
1 parent 888f069 commit 0e63bd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions features/help.feature
Expand Up @@ -21,6 +21,13 @@ Feature: Get help about WP-CLI commands
"""
Error: 'non-existent-command' is not a registered wp command.
"""

When I try `wp help non-existent-command non-existent-subcommand`
Then the return code should be 1
And STDERR should be:
"""
Error: 'non-existent-command non-existent-subcommand' is not a registered wp command.
"""

Scenario: Help for third-party commands
Given a WP install
Expand Down
3 changes: 2 additions & 1 deletion php/commands/help.php
Expand Up @@ -28,7 +28,8 @@ function __invoke( $args, $assoc_args ) {

// WordPress is already loaded, so there's no chance we'll find the command
if ( function_exists( 'add_filter' ) ) {
\WP_CLI::error( sprintf( "'%s' is not a registered wp command.", $args[0] ) );
$command_string = implode( ' ', $args );
\WP_CLI::error( sprintf( "'%s' is not a registered wp command.", $command_string ) );
}
}

Expand Down

0 comments on commit 0e63bd3

Please sign in to comment.