WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

CLI_Command::has_command() public WP-CLI 1.0

Detects if a command exists

This commands checks if a command is registered with WP-CLI. If the command is found then it returns with exit status 0. If the command doesn't exist, then it will exit with status 1.

OPTIONS

<command_name>...
The command

EXAMPLES

# The "site delete" command is registered.
$ wp cli has-command "site delete"
$ echo $?
0
# The "foo bar" command is not registered.
$ wp cli has-command "foo bar"
$ echo $?
1

{} Это метод класса: CLI_Command{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$CLI_Command = new CLI_Command();
$CLI_Command->has_command( $_, $assoc_args );
$_ (обязательный)
-
$assoc_args (обязательный)
-

Код CLI_Command::has_command() WP-CLI 2.5.0

public function has_command( $_, $assoc_args ) {

	// If command is input as a string, then explode it into array.
	$command = explode( ' ', implode( ' ', $_ ) );

	WP_CLI::halt( is_array( WP_CLI::get_runner()->find_command_to_run( $command ) ) ? 0 : 1 );
}