WP_CLI\Dispatcher

RootCommand{}WP-CLI 1.0

The root node in the command tree.

No Hooks.

Usage

$RootCommand = new RootCommand();
// use class methods

Methods

  1. public __construct()
  2. public find_subcommand( &$args )
  3. public get_longdesc()

Notes

  • Package: WP_CLI

RootCommand{} code WP-CLI 2.8.0-alpha

class RootCommand extends CompositeCommand {

	public function __construct() {
		$this->parent = false;

		$this->name = 'wp';

		$this->shortdesc = 'Manage WordPress through the command-line.';
	}

	/**
	 * Get the human-readable long description.
	 *
	 * @return string
	 */
	public function get_longdesc() {
		return $this->get_global_params( true );
	}

	/**
	 * Find a subcommand registered on the root
	 * command.
	 *
	 * @param array $args
	 * @return Subcommand|false
	 */
	public function find_subcommand( &$args ) {
		$command = array_shift( $args );

		Utils\load_command( $command );

		if ( ! isset( $this->subcommands[ $command ] ) ) {
			return false;
		}

		return $this->subcommands[ $command ];
	}
}