Skip to content
Merged
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
15 changes: 9 additions & 6 deletions php/WP_CLI/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -1948,16 +1948,19 @@ private function auto_check_update() {
* Get a suggestion on similar (sub)commands when the user entered an
* unknown (sub)command.
*
* @param string $entry User entry that didn't match an
* existing command.
* @param CompositeCommand $root_command Root command to start search for
* suggestions at.
* @param string $entry User entry that didn't match an
* existing command.
* @param CompositeCommand|null $root_command Root command to start search for
* suggestions at.
*
* @return string Suggestion that fits the user entry, or an empty string.
*/
private function get_subcommand_suggestion( $entry, CompositeCommand $root_command = null ) {
private function get_subcommand_suggestion( $entry, $root_command = null ) {
$commands = [];
$this->enumerate_commands( $root_command ?: WP_CLI::get_root_command(), $commands );
if ( ( $root_command instanceof CompositeCommand ) === false ) {
$root_command = WP_CLI::get_root_command();
}
$this->enumerate_commands( $root_command, $commands );

return Utils\get_suggestion( $entry, $commands, $threshold = 2 );
}
Expand Down