Skip to content
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

Default value of option in repeated subcommand not applied correctly #1381

Closed
sfeuerhahn opened this issue Jun 7, 2021 · 0 comments · Fixed by #1382
Closed

Default value of option in repeated subcommand not applied correctly #1381

sfeuerhahn opened this issue Jun 7, 2021 · 0 comments · Fixed by #1382
Labels
theme: parser An issue or change related to the parser type: bug 🐛
Milestone

Comments

@sfeuerhahn
Copy link
Contributor

Say I have the following command in which mysubcommand is a repeatable subcommand:
mycommand mysubcommand param mysubcommand -t test param
In this case the first subcommand's default value for the -t option is not set correctly by Interpreter.applyDefaultValues(). The reason seems to be that parsing the second subcommand adds the -t option to the set of initialized arguments: Set<ArgSpec> initialized. This set is then also used when setting the default values of the first subcommand. Thus applyDefaultValues() falsely believes it is already initialized.

@sfeuerhahn sfeuerhahn mentioned this issue Jun 7, 2021
@remkop remkop added type: bug 🐛 theme: parser An issue or change related to the parser labels Jun 8, 2021
@remkop remkop added this to the 4.6.2 milestone Jun 8, 2021
MarkoMackic pushed a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: parser An issue or change related to the parser type: bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants