WP_CLI::get_root_command PHP Method

get_root_command() public static method

public static get_root_command ( )
    public static function get_root_command()
    {
        static $root;
        if (!$root) {
            $root = new Dispatcher\RootCommand();
        }
        return $root;
    }

Usage Example

Example #1
0
File: cli.php Project: nb/wp-cli
 /**
  * Generate tab completion strings.
  */
 function completions()
 {
     foreach (WP_CLI::get_root_command()->get_subcommands() as $name => $command) {
         $subcommands = $command->get_subcommands();
         WP_CLI::line($name . ' ' . implode(' ', array_keys($subcommands)));
     }
 }
All Usage Examples Of WP_CLI::get_root_command