Commit graph

6914 commits

Author SHA1 Message Date
Ed Page
7eaeed3abd docs: Update changelog 2022-10-13 14:12:56 -05:00
Ed Page
0f6ef3003d
Merge pull request #4384 from epage/consistent
fix(error): Be consistent in puncutation
2022-10-13 14:11:02 -05:00
Ed Page
f1ffc63a79 fix(error): Be consistent with rustc diagnostic guidelines
From
https://rustc-dev-guide.rust-lang.org/diagnostics.html#suggestion-style-guide

> Suggestions should not be a question. In particular, language like
> "did you mean" should be avoided. Sometimes, it's unclear why a
> particular suggestion is being made. In these cases, it's better to be
> upfront about what the suggestion is.
>
> The message may contain further instruction such as "to do xyz, use"
> or "to do xyz, use abc".

Inspired by #2766
2022-10-13 14:01:49 -05:00
Ed Page
0f3c98a799 fix(error): Be consistent in puncutation 2022-10-13 13:56:58 -05:00
Ed Page
6422046b81
Merge pull request #4383 from epage/error
refactor(error): Generalize how we report suggestions
2022-10-13 13:31:16 -05:00
Ed Page
b9d298086c refactor(error): Move subcommand suggestion to general suggestions 2022-10-13 13:17:44 -05:00
Ed Page
63eec40652 refactor(error): Clarify distinct suggestion cases 2022-10-13 13:15:11 -05:00
Ed Page
5275660967 refactor(error): Move escape suggestion to general suggestion 2022-10-13 13:10:15 -05:00
Ed Page
813060ea82 refactor(error): Move bad-escape suggestion to general suggestion 2022-10-13 13:03:14 -05:00
Ed Page
7417c75c57 refactor(error): Move escaped-subcmd suggestion to general suggestions 2022-10-13 12:59:13 -05:00
Ed Page
bae951b0c4
Merge pull request #4382 from epage/consistent
fix(error): Consistently indent suggestions
2022-10-13 12:52:15 -05:00
Ed Page
c8cb5bba38 feat(error): General suggestion mechanism 2022-10-13 12:20:04 -05:00
Ed Page
4ec79b1448 refactor(error): Centralize suggestions 2022-10-13 12:12:03 -05:00
Ed Page
a4bcba6840 fix(error): Consistently indent suggestions 2022-10-13 12:10:13 -05:00
Ed Page
de9b92cf55
Merge pull request #4381 from epage/consistent
fix(error): Be more consistent in error quoting
2022-10-13 11:49:23 -05:00
Ed Page
c94136fa59
Merge pull request #4380 from epage/escape
fix(error): Don't suggest '--' when it doesn't help
2022-10-13 11:34:06 -05:00
Ed Page
47704314b1 refactor(error): Consolidate 'did you mean' code 2022-10-13 11:11:17 -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
06e2388972 docs: Clarify default_values_ifs tuple parameters
Fixes #4376
2022-10-12 14:11:40 -05:00
Ed Page
2926824d10 chore: Release 2022-10-12 08:22:25 -05:00
Ed Page
5840d62160 docs: Update changelog 2022-10-12 08:22:14 -05:00
Ed Page
f0223a416c
Merge pull request #4375 from epage/group2
fix(parser): Only add ArgGroup to ArgMatches for command-line
2022-10-12 08:20:16 -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
e98fc7f6eb refactor(parser): Centralize knowledge for explicit 2022-10-12 07:46:39 -05:00
Ed Page
e704adb4ff refactor(parser): Centralize group handling
Since groups are only associated with the occurrence, we can move the
assigning of it to the occurrence start.

This will help centralize other checks
2022-10-12 07:37:41 -05:00
Ed Page
0f30ac76f1 refactor(parser): Remove function wrappers 2022-10-12 07:32:21 -05:00
Ed Page
8cf6d116e3 refactor(parser): Reduce code duplication 2022-10-12 07:31:09 -05:00
Ed Page
84828e8da9 refactor(parser): Remove function wrappers 2022-10-12 07:28:57 -05:00
Ed Page
43c1fa30d0 refactor(parser): Reduce code duplication 2022-10-12 07:26:30 -05:00
Ed Page
e5a7a65153 chore: Release 2022-10-11 10:43:39 -05:00
Ed Page
3b6ed1a450 docs: Update changelog 2022-10-11 10:43:26 -05:00
Ed Page
a6eddb015c
Merge pull request #4371 from epage/unit
feat(derive): Allow type-less fields
2022-10-11 10:42:04 -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
a2f2a9ade1 chore: Release 2022-10-10 11:30:55 -05:00
Ed Page
d821d2f193 docs: Update changelog 2022-10-10 11:30:46 -05:00
Ed Page
f4324229c8
Merge pull request #4366 from epage/try_map
feat(parser): Add TypedValueParser::try_map
2022-10-10 11:28:56 -05:00
Ed Page
2122e2b2dd feat(parser): Add TypedValueParser::try_map
This is a major building block to avoid needing to implement
`TypedValueParser`

Inspired by #4362
2022-10-10 10:54:12 -05:00
Ed Page
233a6be7dc
Merge pull request #4365 from epage/error
feat(error): Allow reproducing clap's errors
2022-10-10 10:53:03 -05:00
Ed Page
502bb93e5b feat(error): Allow reproducing clap's errors
Fixes #4362
2022-10-10 10:25:36 -05:00
Ed Page
5b763e957c docs: Fix value_parser documented From types 2022-10-10 09:00:24 -05:00
Ed Page
a482b8a87b
Merge pull request #4355 from LingMan/patch-1
docs: Fix formatting in docs of value_parser! macro
2022-10-08 20:33:24 -05:00
Ed Page
fd41141071 docs: Clarify args_override_self
Fixes #4357
2022-10-08 20:18:27 -05:00
Ed Page
59bf166183 docs(tutorial): Fix flag actions
Fixes #4359
2022-10-08 20:14:03 -05:00
Ed Page
ec3fdc4a42 chore: Release 2022-10-08 19:58:26 -05:00
Ed Page
ec57becef6 docs: Update changelog 2022-10-08 19:58:13 -05:00
Ed Page
db7439ff1f
Merge pull request #4361 from hargut/fix/dont-count-control-characters-in-line-wrap
fix(clap): line wrap on strings that contain ascii control characters
2022-10-08 19:57:12 -05:00
Harald Gutmann
505f760df9 fix(clap): Early line wrap ascii control chars
counting ascii control sequences lead to unpredictable and early
line breaks on colorized inputs (e.g. syntax highlighted strings)
2022-10-08 19:55:52 +02:00