WP_CLI\Dispatcher

CompositeCommand::add_subcommand()publicWP-CLI 1.0

Add a named subcommand to this composite command's set of contained subcommands.

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

Хуков нет.

Возвращает

null. Ничего.

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

$CompositeCommand = new CompositeCommand();
$CompositeCommand->add_subcommand( $name, $command, $override );
$name(строка) (обязательный)
Represents how subcommand should be invoked
$command(Subcommand|CompositeCommand) (обязательный)
Cub-command to add.
$override(true|false)
Whether to override an existing subcommand of the same name.
По умолчанию: true

Код CompositeCommand::add_subcommand() WP-CLI 2.8.0-alpha

public function add_subcommand( $name, $command, $override = true ) {
	if ( $override || ! array_key_exists( $name, $this->subcommands ) ) {
		$this->subcommands[ $name ] = $command;
	}
}