Пример #1
0
 /**
  * Your main program
  *
  * Arguments and options have been parsed when this is run
  *
  * @param Options $options
  * @return void
  */
 protected function main(Options $options)
 {
     if ($options->getOpt('longflag')) {
         $this->info("longflag was set");
     } else {
         $this->info("longflag was not set");
     }
     if ($options->getOpt('file')) {
         $this->info("file was given as " . $options->getOpt('file'));
     }
     $this->info("Number of arguments: " . count($options->getArgs()));
     $this->success("main finished");
 }
Пример #2
0
 /**
  * Your main program
  *
  * Arguments and options have been parsed when this is run
  *
  * @param Options $options
  * @return void
  */
 protected function main(Options $options)
 {
     switch ($options->getCmd()) {
         case 'foo':
             $this->success('The foo command was called');
             break;
         case 'bar':
             $this->success('The bar command was called');
             break;
         default:
             $this->error('No known command was called, we show the default help instead:');
             echo $options->help();
             exit;
     }
     $this->info('$options->getArgs():');
     var_dump($options->getArgs());
 }
Пример #3
0
 /**
  * Register options and arguments on the given $options object
  *
  * @param Options $options
  * @return void
  */
 protected function setup(Options $options)
 {
     $options->setHelp('This shows how the table formatter works by printing the current php.ini values');
 }