Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion features/runner.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,15 @@ Feature: Runner WP-CLI
Then STDERR should contain:
"""
The --path parameter cannot be empty when provided
"""
"""

Scenario: Suggest 'meta' when 'option' subcommand is run
Given a WP install

When I try `wp network option`
Then STDERR should contain:
"""
Error: 'option' is not a registered subcommand of 'network'. See 'wp help network' for available subcommands.
Did you mean 'meta'?
"""
And the return code should be 1
5 changes: 5 additions & 0 deletions php/WP_CLI/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ public function find_command_to_run( $args ) {
$child = array_pop( $cmd_path );
$parent_name = implode( ' ', $cmd_path );
$suggestion = $this->get_subcommand_suggestion( $child, $command );

if ( 'network' === $parent_name && 'option' === $child ) {
$suggestion = 'meta';
}

return sprintf(
"'%s' is not a registered subcommand of '%s'. See 'wp help %s' for available subcommands.%s",
$child,
Expand Down