addOption() публичный метод

Adds an option.
public addOption ( string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null ) : Command
$name string The option name
$shortcut string The shortcut (can be null)
$mode integer The option mode: One of the InputOption::VALUE_* constants
$description string A description text
$default mixed The default value (must be null for InputOption::VALUE_NONE)
Результат Command The current instance
Пример #1
0
 public static function configureTargetConnectionOptions(BaseCommand $command)
 {
     $command->addOption('target-host', null, InputArgument::OPTIONAL, 'Neo4j source server hostname');
     $command->addOption('target-port', null, InputArgument::OPTIONAL, 'Neo4j source server port');
     $command->addOption('target-user', null, InputArgument::OPTIONAL, 'Neo4j source server username');
     $command->addOption('target-password', null, InputArgument::OPTIONAL, 'Neo4j source server password');
 }
Пример #2
0
 public function createCommand(TaskInfo $taskInfo)
 {
     $task = new Command($taskInfo->getName());
     $task->setDescription($taskInfo->getDescription());
     $task->setHelp($taskInfo->getHelp());
     $args = $taskInfo->getArguments();
     foreach ($args as $name => $val) {
         $description = $taskInfo->getArgumentDescription($name);
         if ($val === TaskInfo::PARAM_IS_REQUIRED) {
             $task->addArgument($name, InputArgument::REQUIRED, $description);
         } elseif (is_array($val)) {
             $task->addArgument($name, InputArgument::IS_ARRAY, $description, $val);
         } else {
             $task->addArgument($name, InputArgument::OPTIONAL, $description, $val);
         }
     }
     $opts = $taskInfo->getOptions();
     foreach ($opts as $name => $val) {
         $description = $taskInfo->getOptionDescription($name);
         $fullName = $name;
         $shortcut = '';
         if (strpos($name, '|')) {
             list($fullName, $shortcut) = explode('|', $name, 2);
         }
         if (is_bool($val)) {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_NONE, $description);
         } else {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_OPTIONAL, $description, $val);
         }
     }
     return $task;
 }
Пример #3
0
 public static function configureOutputOptions(BaseCommand $command)
 {
     $command->addOption('output', null, InputArgument::OPTIONAL, 'Cypher output filename. If unspecified, will use STDOUT. Set to \'default\' to use dump-[source-host]-[yyyyMMdd]-[hhmmss].cypher');
     $command->addOption('clean', null, InputArgument::OPTIONAL, 'Set to false not to clean target database before importing. By default all nodes and relations will be removed.');
     $command->addOption('import-label', null, InputArgument::OPTIONAL, 'The name of the label set on imported nodes to create a temporary index with which to quicker identify nodes when transferring relations. This label and the index on it will be removed after the import.');
     $command->addOption('import-id-key', null, InputArgument::OPTIONAL, 'The name of the key used to hold the node IDs as imported. This attribute and the index on it will be removed after the import.');
     $command->addOption('transactional', null, InputArgument::OPTIONAL, 'Set to true to wrap all cyphers in a transaction. Non-transactional by default.');
 }
Пример #4
0
 public static function configure(Command $command)
 {
     $command->addArgument('path', InputArgument::OPTIONAL, 'Path to benchmark(s)');
     $command->addOption('filter', array(), InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore all benchmarks not matching command filter (can be a regex)');
     $command->addOption('group', array(), InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Group to run (can be specified multiple times)');
     $command->addOption('parameters', null, InputOption::VALUE_REQUIRED, 'Override parameters to use in (all) benchmarks');
     $command->addOption('revs', null, InputOption::VALUE_REQUIRED, 'Override number of revs (revolutions) on (all) benchmarks');
     $command->addOption('time-unit', null, InputOption::VALUE_REQUIRED, 'Override the time unit');
     $command->addOption('precision', null, InputOption::VALUE_REQUIRED, 'Override the measurement precision');
     $command->addOption('mode', null, InputOption::VALUE_REQUIRED, 'Override the unit display mode ("throughput", "time")');
     $command->addOption('progress', 'l', InputOption::VALUE_REQUIRED, 'Progress logger to use, one of <comment>dots</comment>, <comment>classdots</comment>');
     // command option is parsed before the container is compiled.
     $command->addOption('bootstrap', 'b', InputOption::VALUE_REQUIRED, 'Set or override the bootstrap file.');
     $command->addOption('group', array(), InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Group to run (can be specified multiple times)');
 }
Пример #5
0
 /**
  * Configures command to be able to process it later.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $formatDispatchers = $this->container->get('behat.formatter.manager')->getDispatchers();
     $command->addOption('--format', '-f', InputOption::VALUE_REQUIRED, "How to format features. <comment>pretty</comment> is default.\n" . "Default formatters are:\n" . implode("\n", array_map(function ($dispatcher) {
         $comment = '- <comment>' . $dispatcher->getName() . '</comment>: ';
         if ($dispatcher->getDescription()) {
             $comment .= $dispatcher->getDescription();
         } else {
             $comment .= $dispatcher->getClass();
         }
         return $comment;
     }, $formatDispatchers)) . "\n" . "Can use multiple formats at once (splitted with \"<comment>,</comment>\")")->addOption('--out', null, InputOption::VALUE_REQUIRED, "Write formatter output to a file/directory\n" . "instead of STDOUT <comment>(output_path)</comment>.")->addOption('--lang', null, InputOption::VALUE_REQUIRED, 'Print formatter output in particular language.')->addOption('--ansi', null, InputOption::VALUE_NONE, "Whether or not to use ANSI color in the output.\n" . "Behat decides based on your platform and the output\n" . "destination if not specified.")->addOption('--no-ansi', null, InputOption::VALUE_NONE)->addOption('--time', null, InputOption::VALUE_NONE, "Whether or not to show timer in output.")->addOption('--no-time', null, InputOption::VALUE_NONE)->addOption('--paths', null, InputOption::VALUE_NONE, "Whether or not to print sources paths.")->addOption('--no-paths', null, InputOption::VALUE_NONE)->addOption('--snippets', null, InputOption::VALUE_NONE, "Whether or not to print snippets for undefined steps.")->addOption('--no-snippets', null, InputOption::VALUE_NONE)->addOption('--snippets-paths', null, InputOption::VALUE_NONE, "Whether or not to print details about undefined steps\n" . "in their snippets.")->addOption('--no-snippets-paths', null, InputOption::VALUE_NONE)->addOption('--multiline', null, InputOption::VALUE_NONE, "Whether or not to print multiline arguments for steps.")->addOption('--no-multiline', null, InputOption::VALUE_NONE)->addOption('--expand', null, InputOption::VALUE_NONE, "Whether or not to expand scenario outline examples\n" . "tables.\n")->addOption('--no-expand', null, InputOption::VALUE_NONE);
 }
Пример #6
0
 /**
  * @see     Behat\Behat\Console\Configuration\ProcessorInterface::configure()
  */
 public function configure(Command $command)
 {
     $defaultFormatters = FormatManager::getDefaultFormatterClasses();
     $defaultLanguage = null;
     if (($locale = getenv('LANG')) && preg_match('/^([a-z]{2})/', $locale, $matches)) {
         $defaultLanguage = $matches[1];
     }
     $command->addOption('--format', '-f', InputOption::VALUE_REQUIRED, "How to format features. <comment>pretty</comment> is default.\n" . "Default formatters are:\n" . implode("\n", array_map(function ($name) use($defaultFormatters) {
         $class = $defaultFormatters[$name];
         return "- <comment>{$name}</comment>: " . $class::getDescription();
     }, array_keys($defaultFormatters))) . "\n" . "Can use multiple formats at once (splitted with \"<comment>,</comment>\")")->addOption('--out', null, InputOption::VALUE_REQUIRED, "Write formatter output to a file/directory\n" . "instead of STDOUT <comment>(output_path)</comment>.")->addOption('--lang', null, InputOption::VALUE_REQUIRED, 'Print formatter output in particular language.', $defaultLanguage);
     $definition = $command->getDefinition();
     $definition->addOption(new InputSwitch('--[no-]ansi', "Whether or not to use ANSI color in the output.\n" . "Behat decides based on your platform and the output\n" . "destination if not specified."));
     $definition->addOption(new InputSwitch('--[no-]time', "Whether or not to show timer in output."));
     $definition->addOption(new InputSwitch('--[no-]paths', "Whether or not to print sources paths."));
     $definition->addOption(new InputSwitch('--[no-]snippets', "Whether or not to print snippets for undefined steps."));
     $definition->addOption(new InputSwitch('--[no-]snippets-paths', "Whether or not to print details about undefined steps\n" . "in their snippets."));
     $definition->addOption(new InputSwitch('--[no-]multiline', "Whether or not to print multiline arguments for steps."));
     $definition->addOption(new InputSwitch('--[no-]expand', "Whether or not to expand scenario outline examples\n" . "tables.\n"));
 }
 /**
  * Adds the 'moodle' option to a command.
  *
  * @param Command $command
  *
  * @return Command
  */
 protected function addMoodleOption(Command $command)
 {
     $moodle = getenv('MOODLE_DIR') !== false ? getenv('MOODLE_DIR') : '.';
     $command->addOption('moodle', 'm', InputOption::VALUE_REQUIRED, 'Path to Moodle', $moodle);
     return $command;
 }
Пример #8
0
 /**
  * @param $className
  * @param TaskInfo $taskInfo
  * @return Command
  */
 protected function createCommand($className, TaskInfo $taskInfo)
 {
     if ($className === strtolower(Tg::TGCLASS)) {
         $name = $taskInfo->getName();
     } else {
         $camel = preg_replace("/:/", '-', $taskInfo->getName());
         $name = $className . ':' . $camel;
     }
     $task = new Command($name);
     $task->setDescription($taskInfo->getDescription());
     $task->setHelp($taskInfo->getHelp());
     $args = $taskInfo->getArguments();
     foreach ($args as $name => $val) {
         $description = $taskInfo->getArgumentDescription($name);
         if ($val === TaskInfo::PARAM_IS_REQUIRED) {
             $task->addArgument($name, InputArgument::REQUIRED, $description);
         } elseif (is_array($val)) {
             $task->addArgument($name, InputArgument::IS_ARRAY, $description, $val);
         } else {
             $task->addArgument($name, InputArgument::OPTIONAL, $description, $val);
         }
     }
     $opts = $taskInfo->getOptions();
     foreach ($opts as $name => $val) {
         $description = $taskInfo->getOptionDescription($name);
         $fullName = $name;
         $shortcut = '';
         if (strpos($name, '|')) {
             list($fullName, $shortcut) = explode('|', $name, 2);
         }
         if (is_bool($val)) {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_NONE, $description);
         } else {
             $task->addOption($fullName, $shortcut, InputOption::VALUE_OPTIONAL, $description, $val);
         }
     }
     return $task;
 }
Пример #9
0
 /**
  * Configures the ParaTestCommand with PHPUnit specific
  * definitions
  *
  * @param Command $command
  * @return mixed
  */
 public function configure(Command $command)
 {
     $command->addOption('phpunit', null, InputOption::VALUE_REQUIRED, 'The PHPUnit binary to execute. <comment>(default: vendor/bin/phpunit)</comment>')->addOption('runner', null, InputOption::VALUE_REQUIRED, 'Runner or WrapperRunner. <comment>(default: Runner)</comment>')->addOption('bootstrap', null, InputOption::VALUE_REQUIRED, 'The bootstrap file to be used by PHPUnit.')->addOption('configuration', 'c', InputOption::VALUE_REQUIRED, 'The PHPUnit configuration file to use.')->addOption('group', 'g', InputOption::VALUE_REQUIRED, 'Only runs tests from the specified group(s).')->addOption('exclude-group', null, InputOption::VALUE_REQUIRED, 'Don\'t run tests from the specified group(s).')->addOption('stop-on-failure', null, InputOption::VALUE_NONE, 'Don\'t start any more processes after a failure.')->addOption('log-junit', null, InputOption::VALUE_REQUIRED, 'Log test execution in JUnit XML format to file.')->addOption('colors', null, InputOption::VALUE_NONE, 'Displays a colored bar as a test result.')->addOption('testsuite', null, InputOption::VALUE_OPTIONAL, 'Filter which testsuite to run')->addArgument('path', InputArgument::OPTIONAL, 'The path to a directory or file containing tests. <comment>(default: current directory)</comment>')->addOption('path', null, InputOption::VALUE_REQUIRED, 'An alias for the path argument.');
     $this->command = $command;
 }
Пример #10
0
 /**
  * Configures command to be executable by the controller.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--story-syntax', null, InputOption::VALUE_NONE, "Print <comment>*.feature</comment> example." . PHP_EOL . "Use <info>--lang</info> to see specific language.");
 }
Пример #11
0
 /**
  * @inheritdoc
  */
 public function configure(SymfonyCommand $command)
 {
     $command->addOption('--run-steps', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Run steps')->addOption('--return-steps-results', null, InputOption::VALUE_NONE, 'Returns results of step execution');
 }
 /**
  * {@inheritdoc}
  */
 public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
 {
     $this->decoratedCommand->addOption($name, $shortcut, $mode, $description, $default);
     return $this;
 }
Пример #13
0
 /**
  * Configures command to be able to process it later.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--init', null, InputOption::VALUE_NONE, "Create <comment>features</comment> directory structure.\n");
 }
Пример #14
0
 public static function configure(Command $command)
 {
     $command->addOption('uuid', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Run UUID');
     $command->addOption('query', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Storage query');
     $command->addOption('file', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Report XML file');
 }
Пример #15
0
 /**
  * Configures command to be able to process it later.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--story-syntax', null, InputOption::VALUE_NONE, "Print <comment>*.feature</comment> example.\n" . "Use <info>--lang</info> to see specific language.")->addOption('--definitions', '-d', InputOption::VALUE_REQUIRED, "Print all available step definitions:\n" . "- use <info>-dl</info> to just list definition expressions.\n" . "- use <info>-di</info> to show definitions with extended info.\n" . "- use <info>-d 'needle'</info> to find specific definitions.\n" . "Use <info>--lang</info> to see definitions in specific language.\n");
 }
Пример #16
0
 protected function configurePPMOptions(\Symfony\Component\Console\Command\Command $command)
 {
     $command->addOption('bridge', null, InputOption::VALUE_OPTIONAL, 'The bridge we use to convert a ReactPHP-Request to your target framework.', 'HttpKernel')->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Load-Balancer host. Default is 127.0.0.1', '127.0.0.1')->addOption('port', null, InputOption::VALUE_OPTIONAL, 'Load-Balancer port. Default is 8080', 8080)->addOption('workers', null, InputOption::VALUE_OPTIONAL, 'Worker count. Default is 8. Should be minimum equal to the number of CPU cores.', 8)->addOption('app-env', null, InputOption::VALUE_OPTIONAL, 'The environment that your application will use to bootstrap (if any)', 'dev')->addOption('debug', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable debugging so that your application is more verbose, enables also hot-code reloading. 1|0', 1)->addOption('logging', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable http logging to stdout. 1|0', 1)->addOption('static', null, InputOption::VALUE_OPTIONAL, 'Enable/Disable static file serving. 1|0', 1)->addOption('max-requests', null, InputOption::VALUE_OPTIONAL, 'Max requests per worker until it will be restarted', 1000)->addOption('concurrent-requests', null, InputOption::VALUE_OPTIONAL, 'If a worker is allowed to handle more than one request at the same time. This can lead to issues when the application does not support it but makes it faster. (like when they operate on globals at the same time) 1|0', 0)->addOption('bootstrap', null, InputOption::VALUE_OPTIONAL, 'The class that will be used to bootstrap your application', 'PHPPM\\Bootstraps\\Symfony')->addOption('cgi-path', null, InputOption::VALUE_OPTIONAL, 'Full path to the php-cgi executable', false)->addOption('socket-path', null, InputOption::VALUE_OPTIONAL, 'Path to a folder where socket files will be placed. Relative to working-directory or cwd()', '.ppm/run/');
 }
Пример #17
0
 public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
 {
     return $this->innerCommand->addOption($name, $shortcut, $mode, $description, $default);
 }
Пример #18
0
 /**
  * Configures command to be executable by the controller.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--rerun', null, InputOption::VALUE_NONE, 'Re-run scenarios that failed during last execution.');
 }
Пример #19
0
 /**
  * Configures command to be able to process it later.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--parallel', '-l', InputOption::VALUE_REQUIRED, "Specify number of parallel processes to run tests with")->addOption('--worker', '-w', InputOption::VALUE_REQUIRED, "Run test as a worker with following data (for internal use only)");
 }
Пример #20
0
 /**
  * @see     Behat\Behat\Console\Configuration\ProcessorInterface::confiugre()
  */
 public function configure(Command $command)
 {
     $command->addOption('--name', null, InputOption::VALUE_REQUIRED, "Only execute the feature elements which match\n" . "part of the given name or regex.")->addOption('--tags', null, InputOption::VALUE_REQUIRED, "Only execute the features or scenarios with tags\n" . "matching tag filter expression.\n");
 }
Пример #21
0
 public static function configure(Command $command)
 {
     $command->addOption('report', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Report name or configuration in JSON format');
     $command->addOption('output', 'o', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Specify output', array('console'));
 }
Пример #22
0
 /**
  * {@inheritdoc}
  */
 public function configure(Command $command)
 {
     $command->addOption('--suite', '-s', InputOption::VALUE_REQUIRED, 'Only execute a specific suite.');
 }
 public function configure(Command $command)
 {
     $command->addOption('--count-workers', null, InputOption::VALUE_REQUIRED, "Specify the count of workers", 1)->addOption('--worker-number', null, InputOption::VALUE_REQUIRED, "Number of current worker", 0);
 }
 public function configure(Command $command)
 {
     $command->addOption('--tunnel', null, InputOption::VALUE_NONE, "Start <commen>Sauce Connect</comment>.\n");
 }
Пример #25
0
 public static function configure(Command $command)
 {
     $command->addOption('dump-file', 'd', InputOption::VALUE_OPTIONAL, 'Dump XML result to named file');
     $command->addOption('dump', null, InputOption::VALUE_NONE, 'Dump XML result to stdout and suppress all other output');
 }
 /**
  * Configures command to be executable by the controller.
  *
  * @param SymfonyCommand $command
  */
 public function configure(SymfonyCommand $command)
 {
     $command->addOption('--step-through', null, InputOption::VALUE_NONE, 'Pause after every step to aid debugging');
 }
Пример #27
0
 /**
  * {@inheritdoc}
  */
 public function configure(Command $command)
 {
     $description = 'The test suite API to load and run tests.';
     $mode = InputOption::VALUE_REQUIRED;
     $command->addOption(self::OPT_API, 'a', $mode, $description, 'functional');
 }
Пример #28
0
 /**
  * Configures command to be executable by the controller.
  *
  * @param Command $command
  */
 public function configure(Command $command)
 {
     $command->addOption('--append-snippets', null, InputOption::VALUE_NONE, "Appends snippets for undefined steps into main context.")->addOption('--no-snippets', null, InputOption::VALUE_NONE, "Do not print snippets for undefined steps after stats.");
 }
 /**
  * {@inheritdoc}
  */
 public function configure(Command $command)
 {
     $command->addOption('--definitions', '-d', InputOption::VALUE_REQUIRED, "Print all available step definitions:" . PHP_EOL . "- use <info>--definitions l</info> to just list definition expressions." . PHP_EOL . "- use <info>--definitions i</info> to show definitions with extended info." . PHP_EOL . "- use <info>--definitions 'needle'</info> to find specific definitions." . PHP_EOL . "Use <info>--lang</info> to see definitions in specific language.");
 }
Пример #30
0
 /**
  * {@inheritdoc}
  */
 public function configure(Command $command)
 {
     $command->addOption('--format', '-f', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'How to format tests output. <comment>pretty</comment> is default.' . PHP_EOL . 'Available formats are:' . PHP_EOL . $this->getFormatterDescriptions() . 'You can use multiple formats at the same time.')->addOption('--out', '-o', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Write format output to a file/directory instead of' . PHP_EOL . 'STDOUT <comment>(output_path)</comment>. You can also provide different' . PHP_EOL . 'outputs to multiple formats.')->addOption('--format-settings', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Set formatters parameters using json object.' . PHP_EOL . 'Keys are parameter names, values are values.');
 }