示例#1
0
 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;
 }
示例#2
0
 public function formatHelp()
 {
     $max = 0;
     foreach ($this->arguments->getArguments() as $argument) {
         $length = strlen($argument->getName()) + 2;
         if ($max < $length) {
             $max = $length;
         }
     }
     foreach ($this->options->getOptions() as $option) {
         $length = strlen($option->getName()) + 6;
         if ($max < $length) {
             $max = $length;
         }
     }
     $synopsys = $this->getName();
     $synopsys .= $this->arguments . $this->options;
     $res = nbHelpFormatter::formatSynopsys($synopsys);
     $res .= nbHelpFormatter::formatArguments($this->arguments, $max);
     $res .= nbHelpFormatter::formatOptions($this->options, $max - 6);
     return $res;
 }