WP_CLI

Runner::get_subcommand_suggestion()privateWP-CLI 1.0

Get a suggestion on similar (sub)commands when the user entered an unknown (sub)command.

Метод класса: Runner{}

Хуков нет.

Возвращает

Строку. 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)
Root command to start search for suggestions at.
По умолчанию: null

Код Runner::get_subcommand_suggestion() WP-CLI 2.8.0-alpha

private function get_subcommand_suggestion( $entry, CompositeCommand $root_command = null ) {
	$commands = [];
	$this->enumerate_commands( $root_command ?: WP_CLI::get_root_command(), $commands );

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