Beispiel #1
0
 private static function find_subcommand($args)
 {
     $command = \Terminus::get_root_command();
     while (!empty($args) && $command && $command->can_have_subcommands()) {
         $command = $command->find_subcommand($args);
     }
     return $command;
 }
Beispiel #2
0
 public function find_command_to_run($args)
 {
     $command = \Terminus::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 command. See 'terminus help'.", $full_name);
         }
         $command = $subcommand;
     }
     return array($command, $args, $cmd_path);
 }
Beispiel #3
0
 /**
  * Dump the list of installed commands, as JSON.
  *
  * @subcommand cmd-dump
  */
 function cmd_dump()
 {
     $this->output()->outputDump(self::command_to_array(Terminus::get_root_command()));
 }
Beispiel #4
0
 /**
  * Dump the list of installed commands, as JSON.
  *
  * @subcommand cmd-dump
  */
 function cmd_dump()
 {
     echo \Terminus\Utils\json_dump(self::command_to_array(Terminus::get_root_command()));
 }