OSDN Git Service

deprecate WP_CLI::add_man_dir()
authorscribu <mail@scribu.net>
Sun, 4 Aug 2013 13:27:56 +0000 (16:27 +0300)
committerscribu <mail@scribu.net>
Sun, 4 Aug 2013 17:58:19 +0000 (20:58 +0300)
features/help.feature
php/class-wp-cli.php

index 3aef3db..10626d6 100644 (file)
@@ -19,35 +19,6 @@ Feature: Get help about WP-CLI commands
     Then the return code should be 1
     And STDERR should not be empty
 
-  Scenario: Help for third-party commands
-    Given a WP install
-    And a wp-content/plugins/test-cli/test-help.txt file:
-      """
-      ## EXAMPLES
-
-          wp test-help
-      """
-    And a wp-content/plugins/test-cli/command.php file:
-      """
-      <?php
-      // Plugin Name: Test CLI Help
-
-      class Test_Help extends WP_CLI_Command {
-        function __invoke() {}
-      }
-
-      WP_CLI::add_command( 'test-help', 'Test_Help' );
-
-      WP_CLI::add_man_dir( __DIR__, __DIR__ );
-      """
-    And I run `wp plugin activate test-cli`
-
-    When I run `wp help test-help`
-    Then STDOUT should contain:
-      """
-      wp test-help
-      """
-
   Scenario: Help for incomplete commands
     Given an empty directory
 
index 1408f97..da3a32b 100644 (file)
@@ -14,14 +14,10 @@ class WP_CLI {
 
        private static $hooks = array(), $hooks_passed = array();
 
-       private static $man_dirs = array();
-
        /**
         * Initialize WP_CLI static variables.
         */
        static function init() {
-               self::add_man_dir( null, WP_CLI_ROOT . "/man-src" );
-
                self::$configurator = new WP_CLI\Configurator( WP_CLI_ROOT . '/php/config-spec.php' );
        }
 
@@ -102,14 +98,6 @@ class WP_CLI {
                self::get_root_command()->add_subcommand( $name, $command );
        }
 
-       static function add_man_dir( $deprecated = null, $src_dir ) {
-               self::$man_dirs[] = $src_dir;
-       }
-
-       static function get_man_dirs() {
-               return self::$man_dirs;
-       }
-
        /**
         * Display a message in the CLI and end with a newline
         *
@@ -276,6 +264,14 @@ class WP_CLI {
                self::get_runner()->run_command( $args, $assoc_args );
        }
 
+
+
+       // DEPRECATED STUFF
+
+       static function add_man_dir() {
+               trigger_error( 'WP_CLI::add_man_dir() is deprecated. Add docs inline.', E_USER_WARNING );
+       }
+
        // back-compat
        static function out( $str ) {
                echo $str;