本文整理汇总了PHP中Symfony\Component\Console\Command\Command::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::addOption方法的具体用法?PHP Command::addOption怎么用?PHP Command::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Command\Command
的用法示例。
在下文中一共展示了Command::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureTargetConnectionOptions
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: createCommand
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: configureOutputOptions
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: configure
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: configure
/**
* 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: configure
/**
* @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"));
}
示例7: addMoodleOption
/**
* 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: createCommand
/**
* @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: configure
/**
* 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: configure
/**
* 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: configure
/**
* @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');
}
示例12: addOption
/**
* {@inheritdoc}
*/
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
{
$this->decoratedCommand->addOption($name, $shortcut, $mode, $description, $default);
return $this;
}
示例13: configure
/**
* 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: configure
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: configure
/**
* 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");
}