Implement negatable option

This commit is contained in:
Jérémy Derussé 2021-01-04 09:45:40 +01:00
parent 8d455dbd0c
commit 1a9a3c34c9
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2
46 changed files with 399 additions and 408 deletions

View File

@ -1033,7 +1033,7 @@ class Application implements ResetInterface
new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
new InputOption('--ansi', '', InputOption::VALUE_BINARY, 'Force ANSI output', null),
new InputOption('--ansi', '', InputOption::VALUE_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null),
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
]);
}

View File

@ -5,6 +5,7 @@ CHANGELOG
-----
* Added `GithubActionReporter` to render annotations in a Github Action
* Added `InputOption::VALUE_NEGATABLE` flag to handle `--foo`/`--no-foo` options.
5.2.0
-----

View File

@ -40,6 +40,9 @@ class JsonDescriptor extends Descriptor
protected function describeInputOption(InputOption $option, array $options = [])
{
$this->writeData($this->getInputOptionData($option), $options);
if ($option->isNegatable()) {
$this->writeData($this->getInputOptionData($option, true), $options);
}
}
/**
@ -111,15 +114,22 @@ class JsonDescriptor extends Descriptor
];
}
private function getInputOptionData(InputOption $option): array
private function getInputOptionData(InputOption $option, bool $negated = false): array
{
return [
return $negated ? [
'name' => '--no-'.$option->getName(),
'shortcut' => '',
'accept_value' => false,
'is_value_required' => false,
'is_multiple' => false,
'description' => 'Negate the "--'.$option->getName().'" option',
'default' => false,
] : [
'name' => '--'.$option->getName(),
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),
'is_negatable' => $option->isNegatable(),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
];
@ -134,10 +144,10 @@ class JsonDescriptor extends Descriptor
$inputOptions = [];
foreach ($definition->getOptions() as $name => $option) {
if ($option->isHidden()) {
continue;
}
$inputOptions[$name] = $this->getInputOptionData($option);
if ($option->isNegatable()) {
$inputOptions['no-'.$name] = $this->getInputOptionData($option, true);
}
}
return ['arguments' => $inputArguments, 'options' => $inputOptions];

View File

@ -68,8 +68,10 @@ class MarkdownDescriptor extends Descriptor
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
$negatable = $option->isNegatable() ? '[no-]' : '';
$name = '--'.$negatable.$option->getName();
$name = '--'.$option->getName();
if ($option->isNegatable()) {
$name .= '|--no-'.$option->getName();
}
if ($option->getShortcut()) {
$name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
}
@ -107,9 +109,6 @@ class MarkdownDescriptor extends Descriptor
$this->write('### Options');
foreach ($definition->getOptions() as $option) {
if ($option->isHidden()) {
continue;
}
$this->write("\n\n");
if (null !== $describeInputOption = $this->describeInputOption($option)) {
$this->write($describeInputOption);

View File

@ -56,12 +56,10 @@ class TextDescriptor extends Descriptor
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
$default = '';
if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
} elseif ($option->isNegatable() && (null !== $option->getDefault())) {
$negative_default = $option->getDefault() ? '' : 'no-';
$default = sprintf('<comment> [default: --%s%s]</comment>', $negative_default, $option->getName());
} else {
$default = '';
}
$value = '';
@ -74,10 +72,9 @@ class TextDescriptor extends Descriptor
}
$totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]);
$negatable = $option->isNegatable() ? '[no-]' : '';
$synopsis = sprintf('%s%s',
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
sprintf('--%s%s%s', $negatable, $option->getName(), $value)
sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
);
$spacingWidth = $totalWidth - Helper::strlen($synopsis);
@ -120,9 +117,6 @@ class TextDescriptor extends Descriptor
$this->writeText('<comment>Options:</comment>', $options);
foreach ($definition->getOptions() as $option) {
if ($option->isHidden()) {
continue;
}
if (\strlen($option->getShortcut()) > 1) {
$laterOptions[] = $option;
continue;
@ -331,8 +325,9 @@ class TextDescriptor extends Descriptor
foreach ($options as $option) {
// "-" + shortcut + ", --" + name
$nameLength = 1 + max(Helper::strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
if ($option->acceptValue()) {
if ($option->isNegatable()) {
$nameLength += 6 + Helper::strlen($option->getName()); // |--no- + name
} elseif ($option->acceptValue()) {
$valueLength = 1 + Helper::strlen($option->getName()); // = + value
$valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]

View File

@ -38,9 +38,7 @@ class XmlDescriptor extends Descriptor
$definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($definition->getOptions() as $option) {
if (!$option->isHidden()) {
$this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
}
$this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
}
return $dom;
@ -212,7 +210,6 @@ class XmlDescriptor extends Descriptor
$objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
$objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
$objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
$objectXML->setAttribute('is_negatable', $option->isNegatable() ? 1 : 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
@ -228,6 +225,17 @@ class XmlDescriptor extends Descriptor
}
}
if ($option->isNegatable()) {
$dom->appendChild($objectXML = $dom->createElement('option'));
$objectXML->setAttribute('name', '--no-'.$option->getName());
$objectXML->setAttribute('shortcut', '');
$objectXML->setAttribute('accept_value', 0);
$objectXML->setAttribute('is_value_required', 0);
$objectXML->setAttribute('is_multiple', 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option'));
}
return $dom;
}
}

View File

@ -208,7 +208,21 @@ class ArgvInput extends Input
*/
private function addLongOption(string $name, $value)
{
$option = $this->getOptionDefinition($name);
if (!$this->definition->hasOption($name)) {
if (!$this->definition->hasNegation($name)) {
throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
}
$optionName = $this->definition->negationToName($name);
if (null !== $value) {
throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
}
$this->options[$optionName] = false;
return;
}
$option = $this->definition->getOption($name);
if (null !== $value && !$option->acceptValue()) {
throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
@ -225,8 +239,15 @@ class ArgvInput extends Input
}
}
$name = $option->effectiveName();
$value = $option->checkValue($value);
if (null === $value) {
if ($option->isValueRequired()) {
throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
}
if (!$option->isArray() && !$option->isValueOptional()) {
$value = true;
}
}
if ($option->isArray()) {
$this->options[$name][] = $value;

View File

@ -164,7 +164,30 @@ class ArrayInput extends Input
*/
private function addLongOption(string $name, $value)
{
$this->setOption($name, $value);
if (!$this->definition->hasOption($name)) {
if (!$this->definition->hasNegation($name)) {
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
}
$optionName = $this->definition->negationToName($name);
$this->options[$optionName] = false;
return;
}
$option = $this->definition->getOption($name);
if (null === $value) {
if ($option->isValueRequired()) {
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
}
if (!$option->isValueOptional()) {
$value = true;
}
}
$this->options[$name] = $value;
}
/**

View File

@ -146,8 +146,11 @@ abstract class Input implements InputInterface, StreamableInputInterface
*/
public function getOption(string $name)
{
$option = $this->getOptionDefinition($name);
return \array_key_exists($name, $this->options) ? $this->options[$name] : $option->getDefault();
if (!$this->definition->hasOption($name)) {
throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
}
return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
}
/**
@ -155,8 +158,11 @@ abstract class Input implements InputInterface, StreamableInputInterface
*/
public function setOption(string $name, $value)
{
$option = $this->getOptionDefinition($name);
$this->options[$option->effectiveName()] = $option->checkValue($value);
if (!$this->definition->hasOption($name)) {
throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
}
$this->options[$name] = $value;
}
/**
@ -192,20 +198,4 @@ abstract class Input implements InputInterface, StreamableInputInterface
{
return $this->stream;
}
/**
* Look up the option definition for the given option name.
*
* @param string $name
*
* @return InputOption
*/
protected function getOptionDefinition($name)
{
if (!$this->definition->hasOption($name)) {
throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
}
return $this->definition->getOption($name);
}
}

View File

@ -33,6 +33,7 @@ class InputDefinition
private $hasAnArrayArgument = false;
private $hasOptional;
private $options;
private $negations;
private $shortcuts;
/**
@ -208,6 +209,7 @@ class InputDefinition
{
$this->options = [];
$this->shortcuts = [];
$this->negations = [];
$this->addOptions($options);
}
@ -227,19 +229,6 @@ class InputDefinition
* @throws LogicException When option given already exist
*/
public function addOption(InputOption $option)
{
$this->doAddOption($option);
if ($option->isNegatable()) {
$negatedOption = new NegatedInputOption($option);
$this->doAddOption($negatedOption);
}
}
/**
* @throws LogicException When option given already exist
*/
private function doAddOption(InputOption $option)
{
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
@ -259,6 +248,14 @@ class InputDefinition
$this->shortcuts[$shortcut] = $option->getName();
}
}
if ($option->isNegatable()) {
$negatedName = 'no-'.$option->getName();
if (isset($this->options[$negatedName])) {
throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
}
$this->negations[$negatedName] = $option->getName();
}
}
/**
@ -310,6 +307,14 @@ class InputDefinition
return isset($this->shortcuts[$name]);
}
/**
* Returns true if an InputOption object exists by negated name.
*/
public function hasNegation(string $name): bool
{
return isset($this->negations[$name]);
}
/**
* Gets an InputOption by shortcut.
*
@ -329,7 +334,7 @@ class InputDefinition
{
$values = [];
foreach ($this->options as $option) {
$values[$option->effectiveName()] = $option->getDefault();
$values[$option->getName()] = $option->getDefault();
}
return $values;
@ -351,6 +356,22 @@ class InputDefinition
return $this->shortcuts[$shortcut];
}
/**
* Returns the InputOption name given a negation.
*
* @throws InvalidArgumentException When option given does not exist
*
* @internal
*/
public function negationToName(string $negation): string
{
if (!isset($this->negations[$negation])) {
throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
}
return $this->negations[$negation];
}
/**
* Gets the synopsis.
*
@ -364,9 +385,6 @@ class InputDefinition
$elements[] = '[options]';
} elseif (!$short) {
foreach ($this->getOptions() as $option) {
if ($option->isHidden()) {
continue;
}
$value = '';
if ($option->acceptValue()) {
$value = sprintf(
@ -378,7 +396,8 @@ class InputDefinition
}
$shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
$elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
$negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
$elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
}
}

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Input;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\InvalidOptionException;
use Symfony\Component\Console\Exception\LogicException;
/**
@ -27,8 +26,6 @@ class InputOption
public const VALUE_OPTIONAL = 4;
public const VALUE_IS_ARRAY = 8;
public const VALUE_NEGATABLE = 16;
public const VALUE_HIDDEN = 32;
public const VALUE_BINARY = (self::VALUE_NONE | self::VALUE_NEGATABLE);
private $name;
private $shortcut;
@ -74,7 +71,7 @@ class InputOption
if (null === $mode) {
$mode = self::VALUE_NONE;
} elseif ($mode >= (self::VALUE_HIDDEN << 1) || $mode < 1) {
} elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
}
@ -86,6 +83,9 @@ class InputOption
if ($this->isArray() && !$this->acceptValue()) {
throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
}
if ($this->isNegatable() && $this->acceptValue()) {
throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
}
$this->setDefault($default);
}
@ -110,11 +110,6 @@ class InputOption
return $this->name;
}
public function effectiveName()
{
return $this->getName();
}
/**
* Returns true if the option accepts a value.
*
@ -155,39 +150,11 @@ class InputOption
return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
}
/**
* Returns true if the option is negatable (option --foo can be forced
* to 'false' via the --no-foo option).
*
* @return bool true if mode is self::VALUE_NEGATABLE, false otherwise
*/
public function isNegatable()
public function isNegatable(): bool
{
return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
}
/**
* Returns true if the option should not be shown in help (e.g. a negated
* option).
*
* @return bool true if mode is self::VALUE_HIDDEN, false otherwise
*/
public function isHidden()
{
return self::VALUE_HIDDEN === (self::VALUE_HIDDEN & $this->mode);
}
/**
* Returns true if the option is binary (can be --foo or --no-foo, and
* nothing else).
*
* @return bool true if negatable and does not have a value.
*/
public function isBinary()
{
return $this->isNegatable() && !$this->acceptValue();
}
/**
* Sets the default value.
*
@ -197,9 +164,12 @@ class InputOption
*/
public function setDefault($default = null)
{
if (self::VALUE_NONE === ((self::VALUE_NONE | self::VALUE_NEGATABLE) & $this->mode) && null !== $default) {
if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
}
if (self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode) && null !== $default) {
throw new LogicException('Cannot set a default value when using InputOption::VALUE_NEGATABLE mode.');
}
if ($this->isArray()) {
if (null === $default) {
@ -209,7 +179,7 @@ class InputOption
}
}
$this->default = ($this->acceptValue() || $this->isNegatable()) ? $default : false;
$this->default = $this->acceptValue() ? $default : false;
}
/**
@ -232,27 +202,6 @@ class InputOption
return $this->description;
}
/**
* Checks the validity of a value, and alters it as necessary
*
* @param mixed $value
*
* @return @mixed
*/
public function checkValue($value)
{
if (null === $value) {
if ($this->isValueRequired()) {
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $this->getName()));
}
if (!$this->isValueOptional()) {
return true;
}
}
return $value;
}
/**
* Checks whether the given option equals this one.
*
@ -263,7 +212,6 @@ class InputOption
return $option->getName() === $this->getName()
&& $option->getShortcut() === $this->getShortcut()
&& $option->getDefault() === $this->getDefault()
&& $option->isHidden() === $this->isHidden()
&& $option->isNegatable() === $this->isNegatable()
&& $option->isArray() === $this->isArray()
&& $option->isValueRequired() === $this->isValueRequired()

View File

@ -1,112 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Input;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
/**
* Represents a command line option.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class NegatedInputOption extends InputOption
{
private $primaryOption;
const VALUE_NONE = 1;
const VALUE_REQUIRED = 2;
const VALUE_OPTIONAL = 4;
const VALUE_IS_ARRAY = 8;
const VALUE_NEGATABLE = 16;
const VALUE_HIDDEN = 32;
const VALUE_BINARY = (self::VALUE_NONE | self::VALUE_NEGATABLE);
private $name;
private $shortcut;
private $mode;
private $default;
private $description;
/**
* @param string $name The option name
* @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param int $mode The option mode: One of the VALUE_* constants
* @param string $description A description text
* @param mixed $default The default value (must be null for self::VALUE_NONE)
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
public function __construct(InputOption $primaryOption)
{
$this->primaryOption = $primaryOption;
/* string $name, $shortcut = null, int $mode = null, string $description = '', $default = null */
$name = 'no-' . $primaryOption->getName();
$shortcut = null;
$mode = self::VALUE_HIDDEN;
$description = $primaryOption->getDescription();
$default = $this->negate($primaryOption->getDefault());
parent::__construct($name, $shortcut, $mode, $description, $default);
}
public function effectiveName()
{
return $this->primaryOption->getName();
}
/**
* Sets the default value.
*
* @param mixed $default The default value
*
* @throws LogicException When incorrect default value is given
*/
public function setDefault($default = null)
{
$this->primaryOption->setDefault($this->negate($default));
}
/**
* Returns the default value.
*
* @return mixed The default value
*/
public function getDefault()
{
return $this->negate($this->primaryOption->getDefault());
}
/**
* @inheritdoc
*/
public function checkValue($value)
{
return false;
}
/**
* Negate a value if it is provided.
*
* @param mixed $value
*
* @return mixed
*/
private function negate($value)
{
if ($value === null) {
return $value;
}
return !$value;
}
}

View File

@ -1257,7 +1257,8 @@ class ApplicationTest extends TestCase
$this->assertTrue($inputDefinition->hasOption('verbose'));
$this->assertTrue($inputDefinition->hasOption('version'));
$this->assertTrue($inputDefinition->hasOption('ansi'));
$this->assertTrue($inputDefinition->hasOption('no-ansi'));
$this->assertTrue($inputDefinition->hasNegation('no-ansi'));
$this->assertFalse($inputDefinition->hasOption('no-ansi'));
$this->assertTrue($inputDefinition->hasOption('no-interaction'));
}
@ -1277,7 +1278,7 @@ class ApplicationTest extends TestCase
$this->assertFalse($inputDefinition->hasOption('verbose'));
$this->assertFalse($inputDefinition->hasOption('version'));
$this->assertFalse($inputDefinition->hasOption('ansi'));
$this->assertFalse($inputDefinition->hasOption('no-ansi'));
$this->assertFalse($inputDefinition->hasNegation('no-ansi'));
$this->assertFalse($inputDefinition->hasOption('no-interaction'));
$this->assertTrue($inputDefinition->hasOption('custom'));
@ -1301,7 +1302,7 @@ class ApplicationTest extends TestCase
$this->assertFalse($inputDefinition->hasOption('verbose'));
$this->assertFalse($inputDefinition->hasOption('version'));
$this->assertFalse($inputDefinition->hasOption('ansi'));
$this->assertFalse($inputDefinition->hasOption('no-ansi'));
$this->assertFalse($inputDefinition->hasNegation('no-ansi'));
$this->assertFalse($inputDefinition->hasOption('no-interaction'));
$this->assertTrue($inputDefinition->hasOption('custom'));

View File

@ -80,8 +80,7 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -79,7 +79,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -88,7 +88,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -182,7 +182,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -191,7 +191,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {

View File

@ -42,6 +42,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--raw`
@ -51,6 +52,7 @@ To output raw command help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--help|-h`
@ -60,6 +62,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -69,6 +72,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -78,6 +82,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -87,24 +92,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -114,6 +112,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`list`
@ -160,6 +159,7 @@ To output raw command list
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--format`
@ -169,6 +169,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--help|-h`
@ -178,6 +179,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -187,6 +189,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -196,6 +199,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -205,24 +209,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -232,4 +229,5 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -7,8 +7,7 @@ Console Tool
<info>-h, --help</info> Display help for the given command. When no command is given display help for the <info>list</info> command
<info>-q, --quiet</info> Do not output any message
<info>-V, --version</info> Display this application version
<info> --ansi</info> Force ANSI output
<info> --no-ansi</info> Disable ANSI output
<info> --ansi|--no-ansi</info> Force (or disable --no-ansi) ANSI output
<info>-n, --no-interaction</info> Do not ask any interactive question
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -46,10 +46,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -105,10 +105,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>

View File

@ -83,7 +83,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -92,7 +92,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -186,7 +186,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -195,7 +195,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -265,7 +265,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -274,7 +274,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -361,7 +361,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -370,7 +370,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -438,7 +438,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -447,7 +447,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {
@ -517,7 +517,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Force ANSI output",
"description": "Force (or disable --no-ansi) ANSI output",
"default": false
},
"no-ansi": {
@ -526,7 +526,7 @@
"accept_value": false,
"is_value_required": false,
"is_multiple": false,
"description": "Disable ANSI output",
"description": "Negate the \"--ansi\" option",
"default": false
},
"no-interaction": {

View File

@ -55,6 +55,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--raw`
@ -64,6 +65,7 @@ To output raw command help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--help|-h`
@ -73,6 +75,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -82,6 +85,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -91,6 +95,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -100,24 +105,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -127,6 +125,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`list`
@ -173,6 +172,7 @@ To output raw command list
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--format`
@ -182,6 +182,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--help|-h`
@ -191,6 +192,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -200,6 +202,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -209,6 +212,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -218,24 +222,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -245,6 +242,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`descriptor:command1`
@ -269,6 +267,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -278,6 +277,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -287,6 +287,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -296,24 +297,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -323,6 +317,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`descriptor:command2`
@ -353,6 +348,7 @@ command 2 help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--help|-h`
@ -362,6 +358,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -371,6 +368,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -380,6 +378,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -389,24 +388,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -416,6 +408,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`descriptor:command4`
@ -437,6 +430,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -446,6 +440,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -455,6 +450,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -464,24 +460,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -491,4 +480,5 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -7,8 +7,7 @@ My Symfony application <info>v1.0</info>
<info>-h, --help</info> Display help for the given command. When no command is given display help for the <info>list</info> command
<info>-q, --quiet</info> Do not output any message
<info>-V, --version</info> Display this application version
<info> --ansi</info> Force ANSI output
<info> --no-ansi</info> Disable ANSI output
<info> --ansi|--no-ansi</info> Force (or disable --no-ansi) ANSI output
<info>-n, --no-interaction</info> Do not ask any interactive question
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -46,10 +46,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -105,10 +105,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -138,10 +138,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -179,10 +179,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -210,10 +210,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>
@ -243,10 +243,10 @@
<description>Display this application version</description>
</option>
<option name="--ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Force ANSI output</description>
<description>Force (or disable --no-ansi) ANSI output</description>
</option>
<option name="--no-ansi" shortcut="" accept_value="0" is_value_required="0" is_multiple="0">
<description>Disable ANSI output</description>
<description>Negate the "--ansi" option</description>
</option>
<option name="--no-interaction" shortcut="-n" accept_value="0" is_value_required="0" is_multiple="0">
<description>Do not ask any interactive question</description>

View File

@ -7,8 +7,7 @@ My Symfony application <info>v1.0</info>
<info>-h, --help</info> Display help for the given command. When no command is given display help for the <info>list</info> command
<info>-q, --quiet</info> Do not output any message
<info>-V, --version</info> Display this application version
<info> --ansi</info> Force ANSI output
<info> --no-ansi</info> Disable ANSI output
<info> --ansi|--no-ansi</info> Force (or disable --no-ansi) ANSI output
<info>-n, --no-interaction</info> Do not ask any interactive question
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -46,6 +46,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--raw`
@ -55,6 +56,7 @@ To output raw command help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--help|-h`
@ -64,6 +66,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -73,6 +76,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -82,6 +86,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -91,24 +96,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -118,6 +116,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`list`
@ -164,6 +163,7 @@ To output raw command list
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--format`
@ -173,6 +173,7 @@ The output format (txt, xml, json, or md)
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'txt'`
#### `--help|-h`
@ -182,6 +183,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -191,6 +193,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -200,6 +203,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -209,24 +213,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -236,6 +233,7 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
`descriptor:åèä`
@ -266,6 +264,7 @@ command åèä help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--help|-h`
@ -275,6 +274,7 @@ Display help for the given command. When no command is given display help for th
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--quiet|-q`
@ -284,6 +284,7 @@ Do not output any message
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--verbose|-v|-vv|-vvv`
@ -293,6 +294,7 @@ Increase the verbosity of messages: 1 for normal output, 2 for more verbose outp
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--version|-V`
@ -302,24 +304,17 @@ Display this application version
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`
#### `--ansi`
#### `--ansi|--no-ansi`
Force ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Default: `false`
#### `--no-ansi`
Disable ANSI output
Force (or disable --no-ansi) ANSI output
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: yes
* Default: `false`
#### `--no-interaction|-n`
@ -329,4 +324,5 @@ Do not ask any interactive question
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -7,8 +7,7 @@ MbString åpplicätion
<info>-h, --help</info> Display help for the given command. When no command is given display help for the <info>list</info> command
<info>-q, --quiet</info> Do not output any message
<info>-V, --version</info> Display this application version
<info> --ansi</info> Force ANSI output
<info> --no-ansi</info> Disable ANSI output
<info> --ansi|--no-ansi</info> Force (or disable --no-ansi) ANSI output
<info>-n, --no-interaction</info> Do not ask any interactive question
<info>-v|vv|vvv, --verbose</info> Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -7,8 +7,7 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -13,8 +13,7 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -13,8 +13,7 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -13,8 +13,7 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

View File

@ -26,4 +26,5 @@ command 2 help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -26,4 +26,5 @@ command åèä help
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -5,4 +5,5 @@
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -13,4 +13,5 @@
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -3,4 +3,5 @@
* Accept value: no
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `false`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `'default_value'`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `NULL`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: no
* Is multiple: yes
* Is negatable: no
* Default: `array ()`

View File

@ -6,4 +6,5 @@ option description
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `NULL`

View File

@ -5,4 +5,5 @@ option with multiple shortcuts
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `NULL`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: no
* Is multiple: no
* Is negatable: no
* Default: `INF`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: yes
* Is multiple: no
* Is negatable: no
* Default: `'style'`

View File

@ -5,4 +5,5 @@ option description
* Accept value: yes
* Is value required: yes
* Is multiple: yes
* Is negatable: no
* Default: `array ( 0 => 'Hello', 1 => 'world',)`

View File

@ -51,6 +51,16 @@ class ArgvInputTest extends TestCase
$this->assertSame($expectedOptions, $input->getOptions(), $message);
}
/**
* @dataProvider provideNegatableOptions
*/
public function testParseOptionsNegatable($input, $options, $expectedOptions, $message)
{
$input = new ArgvInput($input);
$input->bind(new InputDefinition($options));
$this->assertEquals($expectedOptions, $input->getOptions(), $message);
}
public function provideOptions()
{
return [
@ -177,6 +187,36 @@ class ArgvInputTest extends TestCase
];
}
public function provideNegatableOptions()
{
return [
[
['cli.php', '--foo'],
[new InputOption('foo', null, InputOption::VALUE_NEGATABLE)],
['foo' => true],
'->parse() parses long options without a value',
],
[
['cli.php', '--foo'],
[new InputOption('foo', null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)],
['foo' => true],
'->parse() parses long options without a value',
],
[
['cli.php', '--no-foo'],
[new InputOption('foo', null, InputOption::VALUE_NEGATABLE)],
['foo' => false],
'->parse() parses long options without a value',
],
[
['cli.php', '--no-foo'],
[new InputOption('foo', null, InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)],
['foo' => false],
'->parse() parses long options without a value',
],
];
}
/**
* @dataProvider provideInvalidInput
*/
@ -189,6 +229,18 @@ class ArgvInputTest extends TestCase
$input->bind($definition);
}
/**
* @dataProvider provideInvalidNegatableInput
*/
public function testInvalidInputNegatable($argv, $definition, $expectedExceptionMessage)
{
$this->expectException('RuntimeException');
$this->expectExceptionMessage($expectedExceptionMessage);
$input = new ArgvInput($argv);
$input->bind($definition);
}
public function provideInvalidInput()
{
return [
@ -260,6 +312,32 @@ class ArgvInputTest extends TestCase
];
}
public function provideInvalidNegatableInput()
{
return [
[
['cli.php', '--no-foo=bar'],
new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NEGATABLE)]),
'The "--no-foo" option does not accept a value.',
],
[
['cli.php', '--no-foo='],
new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NEGATABLE)]),
'The "--no-foo" option does not accept a value.',
],
[
['cli.php', '--no-foo=bar'],
new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)]),
'The "--no-foo" option does not accept a value.',
],
[
['cli.php', '--no-foo='],
new InputDefinition([new InputOption('foo', 'f', InputOption::VALUE_NONE | InputOption::VALUE_NEGATABLE)]),
'The "--no-foo" option does not accept a value.',
],
];
}
public function testParseArrayArgument()
{
$input = new ArgvInput(['cli.php', 'foo', 'bar', 'baz', 'bat']);

View File

@ -31,6 +31,20 @@ class InputOptionTest extends TestCase
new InputOption('foo', 'f', InputOption::VALUE_IS_ARRAY);
}
public function testBooleanWithRequired()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
new InputOption('foo', 'f', InputOption::VALUE_REQUIRED | InputOption::VALUE_NEGATABLE);
}
public function testBooleanWithOptional()
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL | InputOption::VALUE_NEGATABLE);
}
public function testShortcut()
{
$option = new InputOption('foo', 'f');
@ -150,6 +164,14 @@ class InputOptionTest extends TestCase
$option->setDefault('default');
}
public function testDefaultValueWithValueBooleanMode()
{
$this->expectException('LogicException');
$this->expectExceptionMessage('Cannot set a default value when using InputOption::VALUE_NEGATABLE mode.');
$option = new InputOption('foo', 'f', InputOption::VALUE_NEGATABLE);
$option->setDefault('default');
}
public function testDefaultValueWithIsArrayMode()
{
$this->expectException('LogicException');

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Console\Tests\Input;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Exception\InvalidOptionException;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;

View File

@ -31,7 +31,6 @@ Options:
-h, --help Display help for the given command. When no command is given display help for the %s command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug