Ed Page
623ccbc152
style: Make clippy happy
2022-11-24 08:05:21 -06:00
Ed Page
6b62c82fe2
feat(parser): Show available subcommands when one is missing
...
Similar to
- Listing all required arguments when one is missing
- Listing all possible values when no value is provided
This came up when discussing #3572
2022-11-15 10:18:24 -06:00
Ed Page
d21ee513fd
test(parser): Verify subcommand required message
2022-11-15 10:12:05 -06:00
Ed Page
e9cbed34cd
fix(parser): Don't panic on invalid UTF-8 values
...
Fixes #4473
2022-11-11 12:26:04 -06:00
Ed Page
45d26e0013
test(parser): Show UTF8 bug
2022-11-11 12:22:30 -06:00
Ed Page
ec03972023
test(assert): Verify empty positional assert exists
...
Wondered if we had this for #4467 . Figured we should actually test it.
2022-11-09 22:10:37 -06:00
Ed Page
9376a57d40
fix(help): Clarify that 'help' command accepts multiple
...
Making this plural can go either way as
- Clarify it is plural
- This is all really to simulate actually doing subcommands and you only
do one at a time
For now, I lean towards clarifying it is plural
I also tweaked the message to be more consistent with how `--help` and
`-h` describe themselves.
Fixes #4342
2022-11-07 23:04:04 -06:00
Ed Page
dfe9e73880
fix(help): Update auto-next-line to use new padding
...
In clap v4, we changed the padding from 4 to 2 but we didn't update our
calculation for when to switch to next-line-help as it was a magic
number (we tried to catch all of these).
When updating the tests, we also missed that a test was being wrapped
too narrowly
This was found while discussing #3300
2022-11-07 10:36:51 -06:00
Ed Page
c37ab6c205
fix(derive): Allow 'long_help' to force populating from doc comment
...
Fixes #4441
2022-11-07 09:41:52 -06:00
Ed Page
8751152316
test(derive): Verify long_help behavior
2022-11-07 09:36:53 -06:00
Ed Page
79225d3a2d
fix(derive): Allow defaulted value parser for '()' fields
...
Inspired by #4458
This is a compatible change because it turns a compiler error into a
working case.
2022-11-07 06:07:51 -06:00
Ed Page
91daec67ca
fix(derive): Allow skipping enum variants with a value
...
Fixes #4411
2022-10-20 16:44:51 -05:00
Ed Page
45dcf0ed22
fix(parser): Don't make Args exclusive
with their ArgGroup
...
This is most obvious with the derive API as it creates `ArgGroup`s all
over the place now.
Fixes #4396
2022-10-17 19:02:39 -05:00
Ed Page
0f3c98a799
fix(error): Be consistent in puncutation
2022-10-13 13:56:58 -05:00
Ed Page
a4bcba6840
fix(error): Consistently indent suggestions
2022-10-13 12:10:13 -05:00
Ed Page
a964f45b1b
fix(error): Properly quote, color subcommand suggestions
2022-10-13 10:51:17 -05:00
Ed Page
1039c61c53
fix(error): Be more consistent in error quoting
2022-10-13 10:45:38 -05:00
Ed Page
f8053fcedb
fix(error): Don't suggest '--' when it doesn't help
2022-10-13 10:17:11 -05:00
Ed Page
035571fb5a
test(error): Show good/bad trailing suggestions
2022-10-13 09:58:43 -05:00
Ed Page
d0dcaac2ab
fix(parser): Only add ArgGroup to ArgMatches for command-line
...
This will fix `clap_derive`s behavior for optional-flattened groups as
it will properly detect when the group is present (#3566 ).
While I consider this a bug and not part of compatibility guarentees, I
still want to keep in mind user impact which could still prevent this.
Defaults will make the group always-present which has little value and
if anything is relying on this, it is probably an application bug.
2022-10-12 07:52:07 -05:00
Ed Page
b26c01aa0e
feat(derive): Allow type-less fields
...
When overriding other fields, help or version flag, globals, etc, a user
might not care about the value, so let's ignore the lookup.
Been talking about this for a while but Issue #4367 moved this forward
because there wasn't a good way to handle this without changing
behavior.
2022-10-11 10:31:42 -05:00
Ed Page
f86cd0f2ec
Merge pull request #4350 from epage/option
...
feat(derive): Support `Option` when flattening
2022-10-05 16:48:27 -05:00
Ed Page
06d2049931
feat(derive): Support 'Option' when flattening
2022-10-05 16:21:00 -05:00
mattmadeofpasta
b03b60edd1
test(derive): Clarify doc comment
2022-10-04 16:25:07 -04:00
mattmadeofpasta
476a8af4e2
test(derive): Rename text case
2022-10-04 16:24:47 -04:00
Ed Page
7ceb08ac70
fix(derive): Apply doc comments for #[command(subcommand)]
...
This was broken in 8a5a9ba931
. I had
missed this case for parsing doc comments.
2022-10-03 16:04:38 -05:00
Ed Page
39b1ef076e
test(derive): Show derive bug
2022-10-03 15:40:59 -05:00
Ed Page
5f145a23e9
fix(derive): Support 'group' attribute with Parser
2022-09-30 13:44:10 -05:00
Ed Page
1065d6c36b
feat(assert): Help people know about implicit ArgGroups
2022-09-30 12:56:43 -05:00
Ed Page
42122787d7
feat(derive): Report the group id
...
This will be needed when we support flattening for #3165
2022-09-30 12:24:21 -05:00
Ed Page
50ad905b6a
feat(derive): Implicitly populate groups from some structs
...
This implements the basics for #3165 , just missing
- `flatten` support (waiting on improved group support)
- `group` attributes
2022-09-30 11:42:06 -05:00
Ed Page
5017f0d720
fxi(error): Don't report unrelated groups in requries errors
2022-09-30 11:18:47 -05:00
Ed Page
e1b02a11cc
test: Demonstrate bad requires error
2022-09-30 11:02:44 -05:00
Ed Page
cb04c71105
fix(error): Don't report unrelated groups in conflict errors
...
Ideally, a conflict caused by a group itself would show the relevant
group but that is less important than showing a valid, non-garbage,
usage
2022-09-30 10:38:27 -05:00
Ed Page
76b7579341
test: Demonstrate bad group error
2022-09-30 10:00:24 -05:00
Ed Page
993b0a88d7
test: Expand group test
2022-09-30 09:53:09 -05:00
Ed Page
2498147138
feat(derive): Allow skipping the implicit ArgGroup
...
This was prioritized to allow users to workaround problems when the
implicit `ArgGroup` is getting in the way.
Fixes #4279
2022-09-30 09:15:38 -05:00
Ed Page
35eeba0b63
test(derive): Show failure in #4279
2022-09-30 09:05:48 -05:00
Ed Page
4e9f3cca2c
fix(error): Specialize the self-conflicts error
...
Inspired by rust-lang/cargo#11159
2022-09-29 09:54:20 -05:00
Ed Page
2c097814e4
test(error): Self-conflict
2022-09-29 09:43:33 -05:00
Ed Page
5399f49572
fix(error): Quote literals consistently
2022-09-29 08:54:03 -05:00
Ed Page
3683e2c791
fix(parser): Allow one-off self-overrides
...
bat needed this.
See also #4261
2022-09-28 16:45:35 -05:00
Ed Page
2d7874948f
fix(parser): SetFalse should also not allow self-override
2022-09-28 16:26:36 -05:00
Ed Page
cb1cd67009
fix(error): Include failed arg in usage in --flag=bad-value error
2022-09-27 09:25:24 -05:00
Ed Page
12d76d649a
fix(error): Include 'Usage:' title in --flag=bad-value error
2022-09-27 09:20:42 -05:00
Ed Page
3a8d2a579b
test(parser): Verify existing --flag=bad-value case
2022-09-27 09:19:27 -05:00
Ed Page
9bccded7ed
fix(parser): Conflict-with-self is back on by default
...
See #4261 for more details
2022-09-26 13:29:48 -05:00
Ed Page
3c9bca5ead
fix(help)!: Wrapping is behind wrap_help
...
If users don't want `wrap_help` feature, they can put newlines in where
needed. Seems odd to support wrapping when the wrap size is fixed. For
those hard coding the lines, this will save them a decent amount of
size.
2022-09-26 11:45:44 -05:00
Ed Page
4280fdfcbd
fix(help): Replace help writers with renderers
...
The writer is less convenient and isn't offering any performance
benefits of avoidign the extra allocations, so let's render instead.
This supersedes #3874
Fixes #3873
2022-09-22 09:54:19 -05:00
Ed Page
652e71d616
fix(help)!: Provide styled usage to user
...
This will open us up to providing the user with access to the styled
version in the future.
2022-09-22 09:54:19 -05:00