Esempio n. 1
0
 /**
  * Встроенная комманда help реализует отображение справочной информации.
  *
  * Если передедан необязательный параметр $command отображается справка
  * подкомманды.
  * 
  * @param string $command 
  * @return int 0
  */
 protected function cmdHelp($command = null)
 {
     $help = $this->parseHelpFile();
     $subCommands = is_null($command) ? $this->getCommands() : array();
     if (!is_null($command)) {
         $help = $help['inclass'][$command];
     }
     IO::out($help['short']);
     if (!empty($help['main'])) {
         IO::out($help['main']);
     }
     $list = array();
     foreach ($subCommands as $subCmd) {
         $i = $this->getCommandInfo($subCmd);
         $list[$subCmd] = trim($i['help']['short']);
     }
     if (isset($help['inclass']) && count($help['inclass'])) {
         foreach ($help['inclass'] as $inCmd => $v) {
             $list[$inCmd] = trim($v['short']);
         }
     }
     if (count($list)) {
         ksort($list, SORT_STRING);
         IO::out("~WHITE~Commands~~~:");
         IO::outOptions($list);
         IO::out();
     }
     // Command Options
     if (isset($help['options']) && count($help['options'])) {
         io::out('~WHITE~Options~~~:');
         io::outOptions($help['options']);
         io::out();
     }
     // Common IO Help
     IO::out(IO::help());
     return 0;
 }