mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Merge pull request #1286 from taka-oyama/master
Simpler way of handling optional parameters
This commit is contained in:
commit
94bf29756d
@ -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
|
||||
|
@ -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');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user