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
Make sure positionals have MultipleOccurrences
set rather than MultipleValues
#2692
Comments
Could you clarify which cases you are referring to? |
Hmm.. all the code whenever dealing with positionals which are multiple? Not exactly sure what you are asking. |
Can you point me to a specific example? |
I'd have to dig in deeper, those might still be valid cases for multiple values. |
Yeah, they might be valid use cases, but I was just show casing that we need to use the |
There were fewer occasions than I expected where the use of `multiple_values` was superfluous and we could instead use the more predictable `multiple_occurrences`. In terms of the remaining `multiple` split work, clap-rs#1772 will take care of the derive behavior and clap-rs#2692 will resolve any remaining issues with values vs occurrences in positional arguments. Fixes clap-rs#2816
In looking at multiple occurrences and values for issues like clap-rs#2692, I noticed that `...` can mean both multiple values and multiple occurrences, like before we split them. Pros - No syntax change with clap3 Cons - All the reasons we split `multiple` into two Uncertain - I originally started this as part of another branch but I lost track if something depended on this. I'll have to do more digging BREAKING CHANGE: If `--opt [val]...` was meant for - only multiple occurrences, see `[opt]... --opt [val]` - both multiple occurrences and values, see `[opt]... --opt [val]...`
I noticed this while investigating clap-rs#2692. Since we are making multiple-occurrences a thing for positional arguments, this allows us to remove a special case. Another way to look at this is that we should make the default whatever we do for dervies (clap-rs#1772). I'm going to propose we make the derive always turn `Vec<i32>` into multiple occurences and not multiple values (with users being able to change it through attributes), but that is an in-work proposal and not decided yet.
I noticed this while investigating clap-rs#2692. Since we are making multiple-occurrences a thing for positional arguments, this allows us to remove a special case. Another way to look at this is that we should make the default whatever we do for dervies (clap-rs#1772). I'm going to propose we make the derive always turn `Vec<i32>` into multiple occurences and not multiple values (with users being able to change it through attributes), but that is an in-work proposal and not decided yet. BREAKING CHANGE: `Arg::from(...)` will now use `multiple_occurrences` for a positional `...`, rather than `multiple_values`.
When supporting multiple occurrences for positional arguments in clap-rs#2804, I added some tests to cover this but apparently simpler cases fail despite those more complicated tests. This adds more multiple-occurrences tests for positional arguments, fixes them, and in general equates multiple values with occurrences for positional arguments as part of clap-rs#2692. There are a couple more points for consideration for clap-rs#2692 for us to decide on once this unblocks them (usage special case in clap-rs#2977 and how subcommand help should be handled). I fully admit I have not fully quantified the impact of all of these changes and am heavily relying on the quality of our tests to carry this forward.
When supporting multiple occurrences for positional arguments in clap-rs#2804, I added some tests to cover this but apparently simpler cases fail despite those more complicated cases being tested. This adds more multiple-occurrences tests for positional arguments, fixes them, and in general equates multiple values with occurrences for positional arguments as part of clap-rs#2692. There are a couple more points for consideration for clap-rs#2692 for us to decide on once this unblocks them (usage special case in clap-rs#2977 and how subcommand help should be handled). I fully admit I have not fully quantified the impact of all of these changes and am heavily relying on the quality of our tests to carry this forward.
When supporting multiple occurrences for positional arguments in clap-rs#2804, I added some tests to cover this but apparently simpler cases fail despite those more complicated cases being tested. This adds more multiple-occurrences tests for positional arguments, fixes them, and in general equates multiple values with occurrences for positional arguments as part of clap-rs#2692. There are a couple more points for consideration for clap-rs#2692 for us to decide on once this unblocks them (usage special case in clap-rs#2977 and how subcommand help should be handled). I fully admit I have not fully quantified the impact of all of these changes and am heavily relying on the quality of our tests to carry this forward.
When supporting multiple occurrences for positional arguments in clap-rs#2804, I added some tests to cover this but apparently simpler cases fail despite those more complicated cases being tested. This adds more multiple-occurrences tests for positional arguments, fixes them, and in general equates multiple values with occurrences for positional arguments as part of clap-rs#2692. There are a couple more points for consideration for clap-rs#2692 for us to decide on once this unblocks them (usage special case in clap-rs#2977 and how subcommand help should be handled). I fully admit I have not fully quantified the impact of all of these changes and am heavily relying on the quality of our tests to carry this forward.
I noticed this while investigating clap-rs#2692. Since we are making multiple-occurrences a thing for positional arguments, this allows us to remove a special case. Another way to look at this is that we should make the default whatever we do for dervies (clap-rs#1772). I'm going to propose we make the derive always turn `Vec<i32>` into multiple occurences and not multiple values (with users being able to change it through attributes), but that is an in-work proposal and not decided yet. BREAKING CHANGE: `Arg::from(...)` will now use `multiple_occurrences` for a positional `...`, rather than `multiple_values`.
Similar to clap-rs#2977, this changes positional argument `<subcmd>` in `help <subcmd>` to be multiple occurrences, from being multiple values. This is part of clap-rs#2692 where we re-evaluate the usage of multiple values for positionals now that we accept multiple occurrences.
Similar to clap-rs#2977, this changes positional argument `<subcmd>` in `help <subcmd>` to be multiple occurrences, from being multiple values. This is what identified the usage generation bug fixed in clap-rs#2978 and was isolated into the test case `positional_multiple_values_is_dotted`. This is part of clap-rs#2692 where we re-evaluate the usage of multiple values for positionals now that we accept multiple occurrences.
Similar to clap-rs#2977, this changes positional argument `<subcmd>` in `help <subcmd>` to be multiple occurrences, from being multiple values. This is what identified the usage generation bug fixed in clap-rs#2978 and was isolated into the test case `positional_multiple_occurrences_is_dotted`. This is part of clap-rs#2692 where we re-evaluate the usage of multiple values for positionals now that we accept multiple occurrences.
I'm not aware of any work remaining on this issue once we merge #2978, #2977, and #2984, Does anyone want to double check or should we go ahead and close this out once those are merged? (of course we might find more things, like as I work on my experiments for #1772 but those can be responded to as they come up rather than keeping this open without a clear end goal). |
I will double check over the weekend and close this of there is nothing else. |
Double checked and everything looks good. |
Currently, positionals use
MultipleValues
during building of the arg and parsing. We need to change that to rely onMultipleOccurrences
The text was updated successfully, but these errors were encountered: