WP_CLI
Runner::get_subcommand_suggestion
Get a suggestion on similar (sub)commands when the user entered an unknown (sub)command.
Метод класса: Runner{}
Хуков нет.
Возвращает
string. Suggestion that fits the user entry, or an empty string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_subcommand_suggestion( $entry, $root_command );
- $entry(строка) (обязательный)
- User entry that didn't match an existing command.
- $root_command(CompositeCommand|null)
- Root command to start search for suggestions at.
По умолчанию:null
Код Runner::get_subcommand_suggestion() Runner::get subcommand suggestion WP-CLI 2.13.0-alpha
private function get_subcommand_suggestion( $entry, $root_command = null ) {
$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 );
}