Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(Deployer $deployer)
protected function configure()
{
parent::configure();
$this->addOption('format', null, InputOption::VALUE_OPTIONAL, 'The output format (json, yaml)', 'yaml');
$this->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (json, yaml)', 'yaml');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is optional and yaml by default.

$this->getDefinition()->getArgument('selector')->setDefault(['all']);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function configure()
$this
->setName('init')
->setDescription('Initialize deployer in your project')
->addOption('path', 'p', InputOption::VALUE_OPTIONAL, 'Recipe path');
->addOption('path', 'p', InputOption::VALUE_REQUIRED, 'Recipe path');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is optional!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Options are always optional. But when using this option, a value is required.
Valid is init or init --path=/foo/bar.
But init --path without the value is invalid. So the value is not optional for this option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a common mistake. Even in symfony itself I found some wrong usages of VALUE_OPTIONAL: symfony/symfony#60914

}

protected function execute(InputInterface $input, OutputInterface $output): int
Expand Down
Loading