コード例 #1
0
ファイル: nbCommandSet.php プロジェクト: nubee/bee
 public function addCommand(nbCommand $command)
 {
     if ($this->hasCommand($command->getFullName(), false)) {
         throw new InvalidArgumentException(sprintf("[nbCommandSet::addCommand] Command %s already exists", $command->getFullName()));
     }
     $this->commands[$command->getFullName()] = $command;
 }
コード例 #2
0
ファイル: nbHelpCommand.php プロジェクト: nubee/bee
 public function formatHelp(nbCommand $command)
 {
     $max = 0;
     foreach ($command->getArgumentsArray() as $argument) {
         $length = strlen($argument->getName()) + 2;
         if ($max < $length) {
             $max = $length;
         }
     }
     foreach ($command->getOptionsArray() as $option) {
         $length = strlen($option->getName()) + 6;
         if ($max < $length) {
             $max = $length;
         }
     }
     $res = nbHelpFormatter::formatSynopsys($command->getSynopsys());
     $res .= nbHelpFormatter::formatArguments($command->getArguments(), $max);
     $res .= nbHelpFormatter::formatOptions($command->getOptions(), $max - 6);
     $res .= nbHelpFormatter::formatDescription($command->getDescription());
     return $res;
 }
コード例 #3
0
ファイル: nbCommand.php プロジェクト: nubee/bee
 protected function executeCommand(nbCommand $command, $commandLine, $doit, $verbose)
 {
     if ($doit) {
         $parser = new nbCommandLineParser();
         $parser->setDefaultConfigurationDirs($this->getParser()->getDefaultConfigurationDirs());
         $command->run($parser, $commandLine);
     }
     if ($verbose) {
         $this->logLine(sprintf("%s %s\n", $command->getFullName(), $commandLine), nbLogger::COMMENT);
     }
 }
コード例 #4
0
ファイル: nbChainCommand.php プロジェクト: nubee/bee
 public function addCommand(nbCommand $command)
 {
     $this->commands[] = $command;
     $briefDescription = $this->getBriefDescription() . ' -> ' . $command->getFullName();
     $this->setBriefDescription($briefDescription);
 }