Ed Page
76bff6f34e
fix!: Remove rest of deprecated APIs
...
Fixes #4009
2022-08-01 15:21:33 -05:00
Ed Page
686d174e28
Merge pull request #4014 from nt591/patch-1
...
[Documentation] fix typo in arg.rs
2022-08-01 11:57:25 -05:00
Nikhil Thomas
823e5664cd
[Documentation] fix typo in arg.rs
2022-08-01 12:55:04 -04:00
Ed Page
3ac2afd824
Merge pull request #4011 from clap-rs/dependabot/cargo/proc-macro2-1.0.42
...
chore(deps): bump proc-macro2 from 1.0.40 to 1.0.42
2022-08-01 09:23:56 -05:00
Ed Page
3d65d5701e
Merge pull request #4010 from clap-rs/dependabot/cargo/terminal_size-0.2.1
...
chore(deps): bump terminal_size from 0.1.17 to 0.2.1
2022-08-01 09:23:45 -05:00
dependabot[bot]
44350b376e
chore(deps): bump proc-macro2 from 1.0.40 to 1.0.42
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.40 to 1.0.42.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.40...1.0.42 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 07:04:51 +00:00
dependabot[bot]
0bf1627e05
chore(deps): bump terminal_size from 0.1.17 to 0.2.1
...
Bumps [terminal_size](https://github.com/eminence/terminal-size ) from 0.1.17 to 0.2.1.
- [Release notes](https://github.com/eminence/terminal-size/releases )
- [Commits](https://github.com/eminence/terminal-size/compare/v0.1.17...v0.2.1 )
---
updated-dependencies:
- dependency-name: terminal_size
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 07:04:43 +00:00
Ed Page
9037e93c72
docs: Update changelog
2022-07-29 20:55:02 -05:00
Ed Page
957709fe8a
Merge pull request #4005 from epage/error
...
fix(parser): Include required argument in message
2022-07-29 20:21:05 -05:00
Ed Page
40a9061c26
fix(parser): Include required argument in message
...
When suggesting required arguments, we wanted to avoid an argument
showing up in both a group and by itself but we didn't correctly
calculate that, causing no required arguments to show up at times.
Now, we all use the same pool of information for doing the calculations.
This was the type of cleanup that I expected it to drop our binary size
but this added 1k to our .text. Strange.
Fixes #4004
2022-07-29 19:54:32 -05:00
Ed Page
d001952ac4
refactor(usage): Clarify required gathering
2022-07-29 19:23:29 -05:00
Ed Page
e2a6bbfa95
refactor(parser): Simplify calculation for more values
2022-07-29 15:04:03 -05:00
Ed Page
39e5a86391
fix: Update positional for new num_vals
2022-07-29 15:02:08 -05:00
Ed Page
b47464955c
refactor: Switch to getter for number_of_values
2022-07-29 14:51:02 -05:00
Ed Page
edc7ac359f
Merge pull request #4003 from epage/count
...
fix(help): Show when a flag 'ArgAction::Count's
2022-07-29 10:13:53 -05:00
Ed Page
7b8da03014
Merge pull request #4002 from epage/usage
...
fix(help): Remove '...' for optional values
2022-07-29 09:58:04 -05:00
Ed Page
81bc351cfc
fix(help): Show when a flag 'ArgAction::Count's
2022-07-29 09:56:26 -05:00
Ed Page
7cf25008d5
refactor(test): Put expected values by tests
2022-07-29 09:51:28 -05:00
Ed Page
ac32c831fc
fix(help): Remove '...' for optional values
2022-07-29 09:44:29 -05:00
Ed Page
ddef1cbf10
Merge pull request #4001 from epage/num_vals
...
fix!: Simplify min_values/max_values into number_of_values (per occurrence)
2022-07-29 07:04:20 -05:00
Ed Page
eee31e2e31
docs: Provide best practice by example
2022-07-28 21:50:32 -05:00
Ed Page
30f5b11d06
fix!: Replaced min_values
(tota) with number_of_values
(per occurrence)
2022-07-28 21:40:40 -05:00
Ed Page
ccf35ff70c
fix!: Replace min_values
(total) with number_of_values
(per occurrence)
2022-07-28 17:13:41 -05:00
Ed Page
cf8e1fc319
fix(derive): Make Option<Option<T>>
work per occurrence
2022-07-28 16:52:30 -05:00
Ed Page
ab8ef46663
fix: arg!(--long [value]) to per occurrence values
...
Before we did 0..=1 across all occurrences when what we really wanted
was 0..=1 per occurrence. This makes it compatible with
`ArgAction::Append`.
2022-07-28 16:52:30 -05:00
Ed Page
41535d5c46
feat: Extend number_of_values
to support min/max per occurrence
2022-07-28 16:52:25 -05:00
Ed Page
b4dfdcea15
fix!: Change number_of_values to be per occurrence
2022-07-28 16:52:16 -05:00
Ed Page
ae803e1410
test: Port macro/derive test to builder
...
Making sure we cover the expected experience from multiple perspectives
2022-07-28 16:52:06 -05:00
Ed Page
4f756c483f
fix(derive): Make consistent with arg!
...
This has the downside of a regression in `--help`. We expect to fix
that soon-ish.
2022-07-28 16:52:06 -05:00
Ed Page
5444b60361
test: Verify max_values cases for 0 values
2022-07-28 16:51:41 -05:00
Ed Page
630a4894b3
fix(error): Ensure empty possible values isn't shown
2022-07-28 16:48:47 -05:00
Ed Page
81faa8b34b
Merge pull request #4000 from epage/missing
...
fix(parser): Rely on default_missing_value for flag actions
2022-07-28 15:56:05 -05:00
Ed Page
8e20782bfd
fix(parser): Rely on default_missing_value
for flag actions
...
In the short term, this just provides a back door to custom actions.
Longer term, we can explore a `SetConst` action that relies on this
behavior. Really, `SetTrue` and `SetFalse` are shortcuts for such an
action but shortcuts can be helpful for usability.
Apparently, this also reduced `.text` size by 1k
2022-07-28 15:43:08 -05:00
Ed Page
f76a867e3f
fix: Simplify flag parsing
...
Multiple values can only happen from env variables when configured by
the user, so let's not go out of our way to deal with it.
2022-07-28 15:31:40 -05:00
Ed Page
4887695aca
Merge pull request #3999 from epage/usage
...
fix: Misc clean up in prep for #2688
2022-07-28 15:25:45 -05:00
Ed Page
8aa960c984
style: Make clippy happy
2022-07-28 15:11:28 -05:00
Ed Page
c2f5d8d7b7
perf: Reduce amount of code for rendering args
...
Rendering of usage is not in a critical path, so should be more worried
about binary size than performance. That only leaves avoiding coloring
spaces. That shouldn't be a problem, so let's make the binary smaller.
2022-07-28 14:56:33 -05:00
Ed Page
a7a96e02fa
refactor(help): Simplify rendering of arg values
2022-07-28 14:46:19 -05:00
Ed Page
355a8ff90c
fix!: number_of_values
doesn't always imply multiple_values(true)
...
With `number_of_values` being per-occurrence now, its doesn't make sense
for `number_of_values(0)` to set `takes_value(true)` or for
`number_of_values(1)` to set `multiple_values(true)`.
In addition, an assert is made if the user works around this
2022-07-28 14:40:58 -05:00
Ed Page
2be2924f91
test(help): Veriy rendering of min_values
2022-07-28 13:33:42 -05:00
Ed Page
ef9d582464
refactor(test): Consolidate number_of_values tests
2022-07-28 13:28:39 -05:00
Ed Page
15d7f51e88
test(macros): Port optional-value test from derive to arg
2022-07-28 13:27:28 -05:00
Ed Page
5eedb03e45
fix(help): Mark positionals as optional
2022-07-28 13:12:26 -05:00
Ed Page
43aa695ad7
refactor: Abstract access to min_vals
2022-07-28 13:12:18 -05:00
Ed Page
6e9250d4ab
chore: Remove dead test file
2022-07-28 12:17:22 -05:00
Ed Page
11883b6fbc
fix: Remove unused schema
2022-07-28 12:11:35 -05:00
Ed Page
586b49a43c
Merge pull request #3998 from epage/missing
...
fix(parser)!: Apply default_missing_value per occurrence
2022-07-27 20:58:56 -05:00
Ed Page
67adc4acf9
fix(parser)!: Apply default_missing_value per occurrence
...
This both simplifies the code and the model we present to the user,
making more sense.
There is room for further exploration of tying flag actions into this.
2022-07-27 20:23:58 -05:00
Ed Page
ee06707c90
Merge pull request #3992 from epage/action
...
docs: Shift focus from takes_value to actions
2022-07-26 15:45:18 -05:00
Ed Page
5f20fe1930
docs: Shift focus from takes_value to actions
2022-07-26 14:50:51 -05:00