Commit graph

6293 commits

Author SHA1 Message Date
Ed Page
a1256a6e53
Merge pull request #4151 from epage/collapse
fix(usage): Make dont_collapse_args_in_usage the default
2022-08-30 16:34:33 -05:00
Ed Page
1ca4bab206 docs: Update references in changelog 2022-08-30 16:34:20 -05:00
Ed Page
b632b4434f docs: Fix link in changelog 2022-08-30 16:32:12 -05:00
Ed Page
02d27b5ce3 fix(usage): Make dont_collapse_args_in_usage the default
The setting was added to resolve #769.  The reason it was optional is out
of concern for applications with a lot of positional arguments.  I think
those cases are rare enough that we should just push people to override
the usage.  Positional arguments are generally important enough, even if
optional, to show.

As a side effect, this fixed some bugs with
`dont_collapse_args_in_usage` where it would repeat an argument in a
smart usage.

As a side effect, smart usage now shows `--` when it should
2022-08-30 16:12:49 -05:00
Ed Page
c22b78ba61 fix(usage): Don't put in [--] for multiple values
This was added in #165 but the relative value of this doesn't seem worth
the complexity at the moment.
2022-08-30 16:01:22 -05:00
Ed Page
a00cbab1dc fix(usage): Don't list -- as optional for last
`last` must always follow a `--`, so it isn't optional.
2022-08-30 15:41:35 -05:00
Ed Page
e49cdf901f
Merge pull request #4149 from epage/parent-usage
fix(usage): Don't include irrelevant parent args
2022-08-30 14:02:17 -05:00
Ed Page
1dde9268d5 fix(usage): Don't include irrelevant parent args
This was identified in https://github.com/clap-rs/clap/discussions/4134
2022-08-30 13:43:31 -05:00
Ed Page
d791a93ec7 refacor(usage): Remove use of sort 2022-08-30 11:27:14 -05:00
Ed Page
1f734c8661
Merge pull request #4148 from epage/collect
fix(parser): Improve required error messages
2022-08-30 09:49:57 -05:00
Ed Page
8da1f085dd fix(parser): Require earlier, not-present positionals 2022-08-30 09:31:46 -05:00
Ed Page
f3c4bfd993 docs: Forward integrate v3's changelog 2022-08-30 08:54:00 -05:00
Ed Page
2388ace47b refactor(parser): Hoist check into iteration 2022-08-30 08:47:03 -05:00
Ed Page
619b1fb187 perF(usage): Defer de-duplicating to later
This should drop code size
2022-08-30 07:15:50 -05:00
Ed Page
66957f8398 refactor(usage): Make last check clearer 2022-08-29 21:26:39 -05:00
Ed Page
09031fb4ab refactor(usage): Consolidate required bookkeeping 2022-08-29 21:26:35 -05:00
Ed Page
85569514db refactor(usage): Make duplicate check more resilient 2022-08-29 21:26:32 -05:00
Ed Page
3b17f7fdc9 refactor(usage): Pull out duplicate check 2022-08-29 21:26:28 -05:00
Ed Page
ecb632f487 refactor(usage): Split out group processing 2022-08-29 21:26:24 -05:00
Ed Page
26ea3e32d0 refactor(parser): Consolidate the loops 2022-08-29 19:42:21 -05:00
Ed Page
0c9b9d7ec8 fix(parser): Show all required errors at once
This also has the side effect of always using the "smart usage" which is
why the tests changed.
2022-08-29 19:40:35 -05:00
Ed Page
14d910dee1 refactor(parser): Prefer explicit for loops 2022-08-29 17:04:17 -05:00
Ed Page
3c466c63f7 refactor(parser): Flatten required_unless logic 2022-08-29 17:02:05 -05:00
Ed Page
dacc8ff43a refactor(parser): Consolidate presence check 2022-08-29 16:59:58 -05:00
Ed Page
5bbe04ac2a docs: Update changelog 2022-08-29 16:50:04 -05:00
Ed Page
45d56ca9d2
Merge pull request #4145 from epage/optional
fix(help): Ensure consistency in usage
2022-08-29 16:01:59 -05:00
Ed Page
567bff707b
Merge pull request #4144 from epage/collapse-bug
fix(help): Consistently use `[]` for positionals
2022-08-29 15:50:50 -05:00
Ed Page
76dd3a18e2 fix(help): Ensure consistency in usage 2022-08-29 15:50:39 -05:00
Ed Page
29238551ab
Merge pull request #4143 from epage/refactor
refactor(help): Prep for usage fixes
2022-08-29 15:35:08 -05:00
Ed Page
02db3043e2 fix(help): Consistently use [] for positionals
In the usaeg we use `[]` but in the arg list we use `<>`.
2022-08-29 15:34:30 -05:00
Ed Page
5ef803f01a refactor(help): Move close to use 2022-08-29 15:18:46 -05:00
Ed Page
91332267cf refactor(help): Positive logic can clarify intent 2022-08-29 14:29:32 -05:00
Ed Page
87e2d0c2e0 refactor(help): Clarify intent of fn 2022-08-29 14:07:10 -05:00
Ed Page
2b4541fab2 refactor(help): Clean up code 2022-08-29 14:04:27 -05:00
Ed Page
a666328c1f
Merge pull request #4141 from epage/deprecate
fix: Deprecate _os variants
2022-08-29 13:07:48 -05:00
Ed Page
36460aed08 fix: Deprecate _os variants
PR #4096 made them redundant
2022-08-29 12:42:30 -05:00
Ed Page
d61e614660
Merge pull request #4138 from epage/help
fix(help): Command::print_help should respect disable_colored_help
2022-08-29 11:00:17 -05:00
Ed Page
4eeee9b110 fix(help): Command::print_help should respect disable_colored_help 2022-08-29 10:47:08 -05:00
Ed Page
d61292d999
Merge pull request #4136 from sashashura/patch-2
GitHub Workflows security hardening
2022-08-29 07:56:04 -05:00
sashashura
5a563db76a chore: Set permissions 2022-08-28 01:50:11 +03:00
Ed Page
a2f3ee2cfa docs: Update changelog 2022-08-26 20:06:46 -05:00
Ed Page
9a9d3a8e60
Merge pull request #4131 from talklittle/no-global-args-on-help
fix(help): Do not propagate global args to help
2022-08-26 20:05:35 -05:00
Andrew Shu
eec047a6f6 fix(help): Do not propagate global args to help
This prevents global args from showing in help completions,
since help completions should only suggest subcommands.
Adds tests to ensure the args still show in the generated
help messages of subcommands.
2022-08-26 17:48:58 -07:00
Ed Page
1f3df00388
Merge pull request #4130 from epage/structopt
fix(derive): Remove structopt attribute support
2022-08-26 16:23:07 -05:00
Ed Page
ba5eec31f5
Merge pull request #4129 from epage/derive
refactor(derive): Prepare for builder attributes
2022-08-26 16:08:31 -05:00
Ed Page
521a012c28 fix(derive): Remove structopt attribute support 2022-08-26 16:06:10 -05:00
Ed Page
c04fe2fa4b refactor(derive): Allow carrying context with parsed attributes 2022-08-26 15:52:21 -05:00
Ed Page
294868f5d8
Merge pull request #4115 from talklittle/completion-help-parser-flag
feat(complete): Add completion for help subcommands
2022-08-26 15:28:21 -05:00
Andrew Shu
0d0be51606 fix(complete): Fix help completion issues
* Copy hide flag

* Revert global args special handling. Another commit will
address the issue of whether global args should be included in
help subtrees.
2022-08-26 12:57:12 -07:00
Ed Page
f08575e4a3 refactor(derive): Simplify verbatim docs tracking 2022-08-26 14:44:04 -05:00