예제 #1
0
 /**
  * Available options
  *
  * @return mixed
  */
 public function setupOptions()
 {
     $action = new \Vegas\Cli\Task\Action('create', 'Create user account');
     $option = new \Vegas\Cli\Task\Option('email', 'e', 'User email address');
     $option->setRequired(true);
     $action->addOption($option);
     $option = new \Vegas\Cli\Task\Option('password', 'p', 'User password');
     $option->setRequired(true);
     $action->addOption($option);
     $option = new \Vegas\Cli\Task\Option('name', 'n', 'User name');
     $option->setRequired(true);
     $action->addOption($option);
     $this->addTaskAction($action);
 }
예제 #2
0
파일: CustomTask.php 프로젝트: arius86/core
 public function setupOptions()
 {
     $action = new \Vegas\Cli\Task\Action('test', 'Test action');
     //foo option
     $foo = new Option('foo', 'f', 'Foo option. Usage app:custom test -f numberOfSth');
     $foo->setValidator(function ($value) {
         if (!is_numeric($value)) {
             return false;
         }
         return true;
     });
     $foo->setRequired(true);
     $action->addOption($foo);
     $this->addTaskAction($action);
     $this->addTaskAction(new \Vegas\Cli\Task\Action('testError', 'Test error'));
     $this->addTaskAction(new \Vegas\Cli\Task\Action('testWarning', 'Test warning'));
     $this->addTaskAction(new \Vegas\Cli\Task\Action('testSuccess', 'Test success'));
     $this->addTaskAction(new \Vegas\Cli\Task\Action('testObject', 'Test object'));
     $this->addTaskAction(new \Vegas\Cli\Task\Action('testText', 'Test text'));
     $action = new \Vegas\Cli\Task\Action('testArg', 'Test arguments list');
     $option = new Option('arg', 'a', 'Arg option. Usage app:custom:test 999');
     $action->addOption($option);
     $this->addTaskAction($action);
 }