コード例 #1
0
ファイル: HelpCommand.php プロジェクト: 4aficiona2/cli
 /**
  * Gets the basic descriptions of a command's subcommands from internal docs
  *
  * @param [CompositeCommand] $command The command of which to get subcommands
  * @return [array <string>] $subcommands An array of stringified
  *   subcommands of the command
  */
 private function getSubcommands($command)
 {
     $subcommands = array();
     foreach ($command->getSubcommands() as $subcommand) {
         if ($this->recursive) {
             $subcommands[$subcommand->getName()] = $this->getMarkdown($subcommand);
         } else {
             $subcommands[$subcommand->getName()] = $subcommand->getShortdesc();
         }
     }
     return $subcommands;
 }
コード例 #2
0
ファイル: HelpCommand.php プロジェクト: Zacker/cli
 /**
  * Gets the basic descriptions of a command's subcommands from internal docs
  *
  * @param [CompositeCommand] $command The command of which to get subcommands
  * @return [array] $lines An array of stringified subcommands of the command
  */
 private function renderSubcommands($command)
 {
     $subcommands = array();
     foreach ($command->getSubcommands() as $subcommand) {
         $subcommands[$subcommand->getName()] = $subcommand->getShortdesc();
     }
     if (Terminus::getConfig('format') == 'json') {
         return $subcommands;
     }
     $max_len = $this->getMaximumLength(array_keys($subcommands));
     $lines = array();
     foreach ($subcommands as $name => $desc) {
         $lines[] = str_pad($name, $max_len) . "\t\t\t" . $desc;
     }
     return $lines;
 }