\WP_CLI::line( "See 'wp help $this->name <subcommand>' for more information on a specific subcommand." );
}
- function pre_invoke( &$args ) {
- return $this->find_subcommand( $args );
- }
-
function find_subcommand( &$args ) {
$name = array_shift( $args );
}
}
- function pre_invoke( &$args ) {
- $cmd_name = $args[0];
-
- $command = $this->find_subcommand( $args );
-
- if ( !$command )
- \WP_CLI::error( sprintf( "'%s' is not a registered wp command. See 'wp help'.", $cmd_name ) );
-
- return $command;
- }
-
function find_subcommand( &$args ) {
$command = array_shift( $args );
private static function find_command_to_run( $args ) {
$command = \WP_CLI::$root;
+ $cmd_path = array();
+
while ( !empty( $args ) && $command->has_subcommands() ) {
- $subcommand = $command->pre_invoke( $args );
- if ( !$subcommand )
- break;
+ $cmd_path[] = $args[0];
+
+ $subcommand = $command->find_subcommand( $args );
+
+ if ( !$subcommand ) {
+ \WP_CLI::error( sprintf( "'%s' is not a registered wp command. See 'wp help'.",
+ implode( ' ', $cmd_path ) ) );
+ }
$command = $subcommand;
}