OSDN Git Service

move find_command() utility to Help_Command class
authorscribu <mail@scribu.net>
Sun, 9 Jun 2013 21:35:48 +0000 (00:35 +0300)
committerscribu <mail@scribu.net>
Sun, 9 Jun 2013 21:44:21 +0000 (00:44 +0300)
it's not used anywhere else, nor should it be

php/commands/help.php
php/utils.php

index 39e5da3..d2b8691 100644 (file)
@@ -17,12 +17,22 @@ class Help_Command extends WP_CLI_Command {
                        $this->show( $args );
        }
 
+       private static function find_subcommand( $args ) {
+               $command = \WP_CLI::$root;
+
+               while ( !empty( $args ) && $command && $command->has_subcommands() ) {
+                       $command = $command->find_subcommand( $args );
+               }
+
+               return $command;
+       }
+
        private function show( $args ) {
                if ( self::maybe_show_manpage( $args ) ) {
                        exit;
                }
 
-               $command = WP_CLI\Utils\find_subcommand( $args );
+               $command = self::find_subcommand( $args );
 
                if ( $command ) {
                        $command->show_usage();
@@ -42,7 +52,7 @@ class Help_Command extends WP_CLI_Command {
 
                $arg_copy = $args;
 
-               $command = WP_CLI\Utils\find_subcommand( $args );
+               $command = self::find_subcommand( $args );
 
                if ( $command ) {
                        foreach ( WP_CLI::get_man_dirs() as $dest_dir => $src_dir ) {
index 93ffad3..bd5cada 100644 (file)
@@ -382,16 +382,6 @@ function launch_editor_for_input( $input, $title = 'WP-CLI' ) {
        return $output;
 }
 
-function find_subcommand( $args ) {
-               $command = \WP_CLI::$root;
-
-               while ( !empty( $args ) && $command && $command->has_subcommands() ) {
-                       $command = $command->find_subcommand( $args );
-               }
-
-               return $command;
-}
-
 function run_mysql_query( $query, $args ) {
        // TODO: use PDO?