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

fix(usage)!: Switch positionals... from multi-val to mulit-occur #2977

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

epage
Copy link
Member

@epage epage commented Nov 1, 2021

I noticed this while investigating #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 (#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.

@epage epage changed the title fix(usage): Switch positionals... from multi-val to mulit-occur fix(usage)!: Switch positionals... from multi-val to mulit-occur Nov 1, 2021
@epage
Copy link
Member Author

epage commented Nov 1, 2021

Since this is written, I thought I'd go ahead and post it. We can decide if we want this or if we should wait on #1772 before making that decision.

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`.
Copy link
Member

@pksunkara pksunkara left a comment

Choose a reason for hiding this comment

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

Feel free to merge when you get the tests passing unless something else changes or pops up.

epage added a commit to epage/clap that referenced this pull request Nov 1, 2021
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.
epage added a commit to epage/clap that referenced this pull request Nov 1, 2021
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.
epage added a commit to epage/clap that referenced this pull request Nov 1, 2021
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.
epage added a commit to epage/clap that referenced this pull request Nov 2, 2021
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.
@epage
Copy link
Member Author

epage commented Nov 3, 2021

bors r=pksunkara

epage added a commit to epage/clap that referenced this pull request Nov 3, 2021
epage added a commit to epage/clap that referenced this pull request Nov 3, 2021
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.
epage added a commit to epage/clap that referenced this pull request Nov 3, 2021
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.
epage added a commit to epage/clap that referenced this pull request Nov 3, 2021
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.
@bors
Copy link
Contributor

bors bot commented Nov 3, 2021

Build succeeded:

@bors bors bot merged commit ae48175 into clap-rs:master Nov 3, 2021
@epage epage deleted the usage-pos branch November 3, 2021 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants