Skip to content

InputMerger not merging options with defaults properly #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomzx opened this issue Jan 24, 2016 · 2 comments
Closed

InputMerger not merging options with defaults properly #75

tomzx opened this issue Jan 24, 2016 · 2 comments

Comments

@tomzx
Copy link
Owner

tomzx commented Jan 24, 2016

It appears that if an option with InputOption::VALUE_NONE is not set, its default value is false. This in turns, mean that when we merge the input into the configuration, the false value overrides whatever value was set for that option.

Edit: After thinking about this issue for a bit, I've realized that this can be generalized to the fact that we will be unable to properly merge the command line options if they have default values other than null since InputMerger relies on them being null by default to decide if they should take the value of the configuration (if any).

@tomzx tomzx added the bug label Jan 24, 2016
@tomzx tomzx added this to the Candidate for next Minor milestone Jan 24, 2016
@nochso
Copy link
Contributor

nochso commented Jan 24, 2016

Probably comes down to this: How do you disable this on the CLI? Or rather how do you want it to behave?

A way around it could be --path-format <full|relative> with relative as default.

Edit: I mean, since CLI is supposed to have preference, how is it supposed to override a config true?

@tomzx
Copy link
Owner Author

tomzx commented Jan 24, 2016

@nochso But that means that every time we modify a command, we'd have to be aware that InputOption::VALUE_NONE will not work as expected with configuration files. I don't like that.

After looking a bit at Symfony's InputInterface, it doesn't seem like there is any way to tell if an option was set or not since if it is not set, it will return us its default value... See symfony/symfony#8486

@tomzx tomzx changed the title InputMerger not merging InputOption::VALUE_NONE properly InputMerger not merging options with defaults properly Jan 24, 2016
tomzx added a commit that referenced this issue Jan 24, 2016
Add an InspectableArgvInput input class so that we may check if arguments/options are set.
@tomzx tomzx closed this as completed Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants