Commit graph

6317 commits

Author SHA1 Message Date
Ed Page
7e4b5f6196
Merge pull request #4162 from epage/help
fix(usage): Have spillover use TAB
2022-08-31 16:42:32 -05:00
Ed Page
cdcbf1300d fix(usage): Have spillover use TAB
This was missed in #4161
2022-08-31 16:20:56 -05:00
Ed Page
13c1442a6e
Merge pull request #4161 from epage/magic
refactor(help): Reduce magic numbers for indentation
2022-08-31 16:17:48 -05:00
Ed Page
671914b590 fix(error): Make whitespace consistent with self/help
Sometimes errors would use a tab, sometimes four spaces.  This makes it
always four spaces and shares a definition with help.
2022-08-31 16:02:14 -05:00
Ed Page
439c9e7a91 feat(help): Expose clap's indentation to help_template
This will make it easier for help templates to be consistent with clap
2022-08-31 15:42:59 -05:00
Ed Page
803d87b193 refactor(help): Reduce magic numbers 2022-08-31 15:39:15 -05:00
Ed Page
e643e6058a
Merge pull request #4160 from epage/template
fix(help): Remove name/version/author from help
2022-08-31 15:32:02 -05:00
Ed Page
65b5b5f7bf fix(help): Remove name/version/author from help
This is to help shorten it and polish it by removing redundant
information.

This is a part of #4132
2022-08-31 15:06:15 -05:00
Ed Page
cdb812b28b
Merge pull request #4159 from epage/help
fix(help): Clarify short vs long help
2022-08-31 14:38:12 -05:00
Ed Page
1855c57bc6
Merge pull request #4158 from epage/ver
test(help): Verify how version interacts
2022-08-31 14:27:39 -05:00
Ed Page
c1c269b427 fix(help): Clarify short vs long help
In reviewing CLIs for #4132, I found some were providing helps on `-h`
vs `--help` and figured that could be built directly into clap.  I had
considered not making this hint automatic but I figured the overhead of
checking if long exists wouldn't be too bad.  The code exists (no binary
size increase) and just a simple iteration is probably not too slow
compared to everything else.

Fixes #1015
2022-08-31 14:25:46 -05:00
Ed Page
9cc0299c0c test(help): Verify how version interacts 2022-08-31 14:11:00 -05:00
Ed Page
75e340a3d9
Merge pull request #4157 from epage/cleanup
refactor(derive): Be explicit in what is being parsed
2022-08-31 10:24:51 -05:00
Ed Page
78dc60bd37 refactor(derive): Be explicit in what is being parsed 2022-08-31 10:11:49 -05:00
Ed Page
430202b389
Merge pull request #4156 from epage/trim
fix(help): Always trim output
2022-08-31 09:55:08 -05:00
Ed Page
cdfd455ee6 fix(help): Always trim output
This ensures we don't end up with accidental leading or trailing
newlines due to help template variables not being used when a section is
empty.

This is prep for removing name/version from the default template and is
part of #4132
2022-08-31 09:35:33 -05:00
Ed Page
87cc6f9a1e docs: Add workaround to changelog 2022-08-31 09:06:43 -05:00
Ed Page
0a20466597
Merge pull request #4155 from epage/command
fix(help): Use Command in place of Subcommand
2022-08-31 09:04:52 -05:00
Ed Page
42c943844c fix(help): Use Command in place of Subcommand
In switching to title case for help headings (#4123), it caused me to
look at "subcommand" in a fresh light.  I can't quite put my finger on
it but "Subcommand" looks a bit sloppy.  I also have recently been
surveying other CLIs and they just use "command" as well.

All of them are commands anyways, just some are children of others
(subcommands) while others are not (root or top-level commands, or just
command).  Context is good enough for clarifying subcommands from root
commands.

This is part of #4132
2022-08-31 08:53:10 -05:00
Ed Page
c2f9ecde18
Merge pull request #4154 from epage/help
docs: Fix up for changing of help output
2022-08-31 08:48:05 -05:00
Ed Page
a19c2f5d11
Merge pull request #4152 from epage/changes
docs: Make transition easier
2022-08-30 21:40:33 -05:00
Ed Page
3f44dc03d2 docs: Provide workaround for title cased headings 2022-08-30 19:59:42 -05:00
Ed Page
c4dd6aeb42 docs: Update example help 2022-08-30 19:57:26 -05:00
Ed Page
44d3614add revert: Add some deprecated placeholders 2022-08-30 16:47:39 -05:00
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