Merge pull request #1286 from taka-oyama/master

Simpler way of handling optional parameters
This commit is contained in:
Anton Medvedev 2017-08-12 18:15:28 +03:00 committed by GitHub
commit 94bf29756d
3 changed files with 14 additions and 21 deletions

View File

@ -14,6 +14,9 @@
### Changed
- Changed `branch` parameter and option behavior
### Fixed
- Improved the way `ParallelExecutor` handles option parameters
### Removed
- Removed `terminate_message` option
- Removed `Result` class

View File

@ -116,9 +116,9 @@ set('bin/symlink', function () {
/**
* Default options
*/
option('tag', null, InputOption::VALUE_OPTIONAL, 'Tag to deploy');
option('revision', null, InputOption::VALUE_OPTIONAL, 'Revision to deploy');
option('branch', null, InputOption::VALUE_OPTIONAL, 'Branch to deploy');
option('tag', null, InputOption::VALUE_REQUIRED, 'Tag to deploy');
option('revision', null, InputOption::VALUE_REQUIRED, 'Revision to deploy');
option('branch', null, InputOption::VALUE_REQUIRED, 'Branch to deploy');
/**

View File

@ -240,22 +240,6 @@ class ParallelExecutor implements ExecutorInterface
$verbosity = new VerbosityString($this->output);
$input = $verbosity;
// Console options without value
foreach (['quiet', 'ansi', 'no-ansi', 'no-interaction'] as $option) {
$value = $this->input->getOption($option);
if ($value) {
$input .= " --$option";
}
}
// Console options with value
foreach (['log'] as $option) {
$value = $this->input->getOption($option);
if ($value) {
$input .= " --$option=$value";
}
}
// Get user arguments
foreach ($this->console->getUserDefinition()->getArguments() as $argument) {
$value = $this->input->getArgument($argument->getName());
@ -266,9 +250,15 @@ class ParallelExecutor implements ExecutorInterface
// Get user options
foreach ($this->console->getUserDefinition()->getOptions() as $option) {
$value = $this->input->getOption($option->getName());
$name = $option->getName();
$value = $this->input->getOption($name);
if ($value) {
$input .= " --{$option->getName()}=$value";
$input .= " --{$name}";
if ($option->acceptValue()) {
$input .= " {$value}";
}
}
}