OSDN Git Service

show commands defined in plugins when running 'wp help'
authorscribu <mail@scribu.net>
Tue, 6 Aug 2013 22:39:37 +0000 (01:39 +0300)
committerscribu <mail@scribu.net>
Tue, 6 Aug 2013 22:39:37 +0000 (01:39 +0300)
php/WP_CLI/Runner.php

index 4d11ffc..1502ac7 100644 (file)
@@ -337,8 +337,12 @@ class Runner {
                WP_CLI::set_logger( $logger );
        }
 
+       private function wp_exists() {
+               return is_readable( ABSPATH . 'wp-includes/version.php' );
+       }
+
        private function check_wp_version() {
-               if ( !is_readable( ABSPATH . 'wp-includes/version.php' ) ) {
+               if ( !$this->wp_exists() ) {
                        WP_CLI::error(
                                "This does not seem to be a WordPress install.\n" .
                                "Pass --path=`path/to/wordpress` or run `wp core download`." );
@@ -410,14 +414,15 @@ class Runner {
                        }
                }
 
+               // Handle --path parameter
+               self::set_wp_root( $this->config );
+
                // First try at showing man page
-               if ( $this->cmd_starts_with( array( 'help' ) ) ) {
+               if ( 'help' === $this->arguments[0] &&
+                  ( isset( $this->arguments[1] ) || !$this->wp_exists() ) ) {
                        $this->_run_command();
                }
 
-               // Handle --path parameter
-               self::set_wp_root( $this->config );
-
                // Handle --url and --blog parameters
                $url = self::guess_url( $this->config );
                if ( $url ) {