Commit graph

1225 commits

Author SHA1 Message Date
xixishidibei
6f07cf1189 chore: add the missing symbol
Signed-off-by: xixishidibei <xixishidibei@outlook.com>
2024-09-18 16:12:56 +08:00
Ed Page
dc13365938 fix(derive): Improve unsupported field type error message
This is a bit more unconventional but I think its sufficient improvement
to readability to justify it.
2024-08-28 14:03:29 -05:00
Ed Page
a3524273b1 fix(derive): Improve unsupported field type error message 2024-08-28 14:03:18 -05:00
Ed Page
4c386138d2 test(derive): Show ValueParser error 2024-08-28 14:03:00 -05:00
Ed Page
bc6b5ac2e3 test(derive): Require opt-in
These are now running in other situations in CI and feature combinations
have odd side effects on the output.
2024-08-28 14:02:23 -05:00
Ed Page
360bb3bc11 fix(help): Properly wrap subcommand about
Fixes #5607
2024-07-31 16:17:40 -05:00
Ed Page
58b5bd89ea test(help): Show bad subcommand wrapping 2024-07-31 16:17:40 -05:00
Ed Page
7b5b61b021 test(help): Switch to snapbox 2024-07-31 15:58:24 -05:00
Ed Page
13dfdb3870 fix(derive): Improve flattening-skipped-group assert
- Improves the error message
- Happens on initialization, rather than parse, making it so it will
  always show up and not just when certain parts of the CLI are
  exercised

Fixes #5609
2024-07-31 15:19:29 -05:00
Ed Page
4f875ffe20 test(derive): Show existing flatten behavior 2024-07-31 15:10:32 -05:00
Ed Page
c4e0d67bba test(derive): Update UI tests to stable 2024-07-31 14:52:53 -05:00
Zanie Blue
2eb842cc3b feat: Show user defined help flags in hints
This allows display of user-defined help flags during "try 'help'" style
messages
2024-07-08 19:01:22 -05:00
Zanie Blue
b24deb101f test: Add coverage for help flag hints 2024-07-08 19:01:22 -05:00
Lzu Tao
181b9e0d94 test: Ensure optional_value runs 2024-06-26 09:07:07 -04:00
Ed Page
0724b7ba2b chore: Remove tarpaulin support 2024-06-26 09:03:34 -04:00
Ed Page
cf5c95862e fix(parser): Report correct num_args on too-few
Fixes #5526
2024-06-10 09:16:53 -05:00
Ed Page
e0c9619c27 test(parser): Snapshot num_args errors 2024-06-10 09:15:48 -05:00
Ed Page
08656d046e fix(parser): Allow exclusive to override required_*
There are other cases for `required` that aren't being handled
- Groups
- Conflicts

I'm concerned there might be weird corner cases and didn't want the
analysis for that to block fixing this.

Fixes #5507
2024-06-06 15:01:04 -05:00
Ed Page
65e90cd31f test(parser): Show conditional requireds and exclusive 2024-06-06 14:56:40 -05:00
Ed Page
75e2199415 chore: Upgrade snapbox 2024-05-24 10:13:50 -05:00
Ed Page
800d7cb8ad chore: Update from template 2024-05-14 12:27:02 -05:00
Ed Page
126eb3d4dc chore: Encourage a single test binary 2024-03-28 09:48:35 -05:00
Ed Page
df915fefef fix(derive): Re-allow expressions for id's
Fixes #5407
2024-03-25 14:42:22 -05:00
Ed Page
be73195ecf refactor(derive): Clarify tests 2024-03-25 14:08:51 -05:00
Ed Page
446328a8d3 fix(error): Include -- in more cases
Inspired by rust-lang/cargo#12494.
Part of this is that our "did you mean" does prefix checks so it can be
overly aggressive in providing suggestions.
To avoid providing needless suggestions I limited this change to `last`
/ `trailing_var_arg` as those convey that `--` is more likely a valid
suggestion.
2024-02-16 06:54:57 -06:00
Ed Page
7de6df8782 test(error): Show existing last behavior 2024-02-16 06:41:45 -06:00
Ed Page
5f9cecb6bd chore: Update snapbox/trycmd 2024-02-14 16:44:57 -06:00
Ed Page
4b45d361b1 chore: Update MSRV to 1.74 2024-02-08 09:45:17 -06:00
Ed Page
f529ec398c fix(parser): Ensure subcommand flags can conflict
Fixes #5297
2024-01-11 10:25:57 -06:00
Ed Page
a7e04a53e4 fix(parser): Improve subcommand conflict error 2024-01-11 10:20:19 -06:00
Ed Page
69c0509198 test(parser): Verify conflicts with precedence 2024-01-11 09:14:37 -06:00
Ed Page
e2b18f199f test(parser): Show flag behavior 2024-01-11 09:04:35 -06:00
Ed Page
06bff1c955 test(parser): Check subcommands conflict with positionals 2024-01-11 08:48:23 -06:00
Ed Page
70da3a8608 test(parser): Reduce size of test 2024-01-11 08:46:47 -06:00
Ed Page
11fd6ca269 test(parser): Clarify test name 2024-01-11 08:45:40 -06:00
Ed Page
811acc45c1 test(parser): Group subcommandc conflict tests 2024-01-11 08:45:03 -06:00
Sean Allred
05cd057978
perf: Avoid retrieving possible_values unless used
In some sophisticated situations, these may be expensive to calculate.
One example might be a '--branch' option accepting any single Git
branch that exists on the remote -- in such a case, the remote would
need to be queried for all possible_values. The cost is ultimately
unavoidable at runtime since this validation has to happen eventually,
but there's no need to pay it when generating help text if
`is_hide_possible_values_set`.

To keep '-h' fast, avoid collecting `possible_values` during '-h'
unless we're actually going to use the values in display.

This optimization is repeated for the manpage renderer.

This is trivially based on the short-circuiting logic at [1], which at
least supports the idea that actually consuming the iterator is not
generally-guaranteed behavior when `hide_possible_values` is set.

Note on the 'expensive' mod: This keeps all the possible_values tests
in one file but allows the entire set of tests to be controlled by the
'strings' feature (which is required to be able to use String rather
than str for each possible value).

[1]: clap_builder/src/builder/command.rs:long_help_exists_
2023-12-28 10:06:35 -06:00
Ed Page
b13f6d9862 fix(help): Hide 'help' if only flattened subcommand 2023-11-27 10:49:21 -06:00
Ed Page
a9322cabf3 fix(help): Hide subcommands in flattened usage 2023-11-27 10:43:16 -06:00
Ed Page
b6561983a0 test(help): Show how hide and flatten mix 2023-11-27 10:38:05 -06:00
Ed Page
22130e3057 fix(help): Use right about when flattening
Fixes #5226
2023-11-27 09:28:30 -06:00
Ed Page
e9194b55e2 test(help): Better show about bug 2023-11-27 09:23:38 -06:00
Ed Page
9c0f7a7253 fix(help): Recurse help flattening 2023-11-09 15:34:05 -06:00
Ed Page
c9a7ef06e1 fix(help): Gloss over globals with flatten
When using globals, people tend to make all of the top-level arguments
global and cascading them through would just bloat the output.
2023-11-09 15:33:18 -06:00
Ed Page
9e5f93d43f fix(help): Be consistent in long/short help 2023-11-09 15:33:18 -06:00
Ed Page
66d2bcbdd4 feat(help): Allow flattening help 2023-11-09 15:32:57 -06:00
Ed Page
caf5cdcfa0 feat(help): Allow flattening usage 2023-11-09 13:31:22 -06:00
Ed Page
a1fd922bda feat(help): Allow controlling flattening 2023-11-09 13:31:11 -06:00
Ed Page
dfebb54423 style: Make clippy happy 2023-10-12 08:32:59 -05:00
Ed Page
3ac44040ef
Merge pull request #5025 from SUPERCILEX/resolve-alias-conflicts
fix: Resolve conflicting name inference if from aliases
2023-09-25 15:56:28 -05:00