當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WP_CLI::get_root_command方法代碼示例

本文整理匯總了PHP中WP_CLI::get_root_command方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_CLI::get_root_command方法的具體用法?PHP WP_CLI::get_root_command怎麽用?PHP WP_CLI::get_root_command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_CLI的用法示例。


在下文中一共展示了WP_CLI::get_root_command方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: completions

 /**
  * 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)));
     }
 }
開發者ID:nb,項目名稱:wp-cli,代碼行數:10,代碼來源:cli.php

示例2: find_subcommand

 private static function find_subcommand($args)
 {
     $command = \WP_CLI::get_root_command();
     while (!empty($args) && $command && $command->can_have_subcommands()) {
         $command = $command->find_subcommand($args);
     }
     return $command;
 }
開發者ID:wp-cli,項目名稱:wp-cli,代碼行數:8,代碼來源:help.php

示例3: find_command_to_run

 /**
  * Given positional arguments, find the command to execute.
  *
  * @param array $args
  * @return array|string Command, args, and path on success; error message on failure
  */
 public function find_command_to_run($args)
 {
     $command = \WP_CLI::get_root_command();
     $cmd_path = array();
     while (!empty($args) && $command->can_have_subcommands()) {
         $cmd_path[] = $args[0];
         $full_name = implode(' ', $cmd_path);
         $subcommand = $command->find_subcommand($args);
         if (!$subcommand) {
             return sprintf("'%s' is not a registered wp command. See 'wp help'.", $full_name);
         }
         if ($this->is_command_disabled($subcommand)) {
             return sprintf("The '%s' command has been disabled from the config file.", $full_name);
         }
         $command = $subcommand;
     }
     return array($command, $args, $cmd_path);
 }
開發者ID:Jazz-Man,項目名稱:wp-cli,代碼行數:24,代碼來源:Runner.php

示例4: cmd_dump

 /**
  * Dump the list of installed commands, as JSON.
  *
  * @subcommand cmd-dump
  */
 public function cmd_dump()
 {
     echo json_encode(self::command_to_array(WP_CLI::get_root_command()));
 }
開發者ID:supersighs,項目名稱:wp-cli,代碼行數:9,代碼來源:cli.php


注:本文中的WP_CLI::get_root_command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。