Commit graph

4677 commits

Author SHA1 Message Date
Ed Page
fd38d247a7
Merge pull request #3180 from epage/cargo
docs(examples): Add cargo subcommand example
2021-12-15 12:19:26 -06:00
Ed Page
aa270f6aca docs(examples): Add cargo subcommand example 2021-12-15 12:07:29 -06:00
Ed Page
03cb509d6c refactor(examples): Change naming style
This is to make room for a reasonable looking cargo plugin example.

I got lazy and didn't update the tutorials.
2021-12-15 11:12:18 -06:00
Ed Page
1100f04b56 chore: Release 2021-12-15 11:02:40 -06:00
Ed Page
95198c95f3 docs: Update changelog 2021-12-15 11:02:12 -06:00
Ed Page
f0c7a72a5c
Merge pull request #3179 from epage/man
revert(help): Partial revert of 3c049b4
2021-12-15 10:47:48 -06:00
Ed Page
9e64387ef0 revert(help): Partial revert of 3c049b4
The extra whitespace was targeted at machine processing for a subset of
users for a subset of runs of CLIs.  On the other hand, there is a lot
of concern over the extra verbose output.

A user can set the help template for man, if desired.  They can even do
something (env? feature flag?) to make it only run when doing man
generation.  We also have #3174 in the works.

So let's focus on the end-user reading `--help`.  People wanting to use
`help2man` have workarounds to do what they need.

Fixes #3096
2021-12-15 10:36:59 -06:00
Pavan Kumar Sunkara
56ed9981da
Merge pull request #3176 from epage/gen
docs(gen): Use absolute paths for docs.rs sake
2021-12-14 19:35:00 +00:00
Ed Page
8e5a62faed docs(gen): Use absolute paths for docs.rs sake
Using relative paths will work from github but when we include
`README.md` into `lib.rs`, they will break.
2021-12-14 13:02:20 -06:00
Ed Page
b3315f995d
Merge pull request #3175 from epage/help
fix(derive)!: Set both about/long_about with doc comments
2021-12-14 12:04:11 -06:00
Ed Page
d55f040bbd fix(derive): Set both about/long_about with doc comments
The main care about is that when we override a `flatten` / `subcommand`
doc comment in a parent container, that we make sure we take nothing
from the child container, rather than implicitly taking one `about` ut
not `long_about`.

To do this, and to play the most safe with long help detection, we reset
`long_about` to default when there is no doc comment body to use for
`long_about`.

Fixes #2983
2021-12-14 11:07:57 -06:00
Ed Page
1811f5e7af test(derive): Show current doc comment behavior
Based on #2983
2021-12-14 11:07:54 -06:00
Ed Page
80f426af49 feat!: Allow resetting abouts/help to default
I dislike the inconsistency with only a few fields providing this (this
and `help_heading`) but this is to address a specific bug.  We need to
visit this, along with iterators (#2870) and string handling (#2150).

`Arg` came along for the ride because the derive logic is applied to
both.  `PossibleValue` didn't need it because we filter out `long_help`.

BREAKING CHANGE: We changed the signatures for `App::about`,
`App::long_about`, `Arg::help`, and `Arg::long_help` from accepting
anything `Into<&str>` to `&str`.
2021-12-14 11:07:39 -06:00
Ed Page
05cf230ac1
Merge pull request #3170 from epage/default
fix(derive): Treat `default_value_os` like `default_value`
2021-12-13 16:37:26 -06:00
Ed Page
7c10b5a9b4 fix(derive): Treat default_value_os like default_value
The test went from panicing to not-panicing

Fixes #3031
2021-12-13 16:25:49 -06:00
Pavan Kumar Sunkara
8eb55381ca
Merge pull request #3169 from epage/help
fix(help): Don't commit to '--help' that doesn't work
2021-12-13 22:15:58 +00:00
Ed Page
19ed78c64f fix(help): Don't commit to '--help' that doesn't work
We have two ways of fixing this
- Making `--help` work
- Don't put `--help` in the help output

For now, I went with the latter.  I tried to make it clear what the
actual requirement is so we can pivot if needed.

Fixes #2892

This happens to also fix the interaction of `DisableHelpFlag` with the
help subcommand and complcations.  I've added a test to help catch if we
break this by changing how we fixed the original issue.

Fixes #2724

These issues were reported against clap3.  I've not tried to reproduce
these in clap2 to see if they should show up in the release notes.
2021-12-13 15:59:14 -06:00
Ed Page
fa439d4f27
Merge pull request #3168 from epage/error
Ensure trailing newlines at the end of errors
2021-12-13 14:15:22 -06:00
Ed Page
a72e5726f8 fix(error): Ensure newline on value_of_t not found
Found this when auditing for cases related to #2787.
2021-12-13 13:30:32 -06:00
Ed Page
4c8caa6eb3 test(error): Add explicit value_of_t test case
This adds an explicit test case for
221c18bdec when before we covered it via
the example tests.
2021-12-13 13:30:28 -06:00
Ed Page
2eb69def4e fix(error): Ensure trailing newline without help
Fixes #2787
2021-12-13 13:09:48 -06:00
Pavan Kumar Sunkara
6b6f01006d
Merge pull request #3167 from epage/exhaustived
fix!: Allow adding new enum variants
2021-12-13 18:34:35 +00:00
Ed Page
98a1c2e6c9 fix!: Allow adding new enum variants
Without being a breaking change.

This seems minor enough that we can break this during the release
candidates.  For `ValueHint`, the completion scripts are 99% of who
should be `match`ing it.  `AppSettings` as undocumented variants that
people shouldn't use.

BREAKING CHANGE: `clap::{ValueHint, ErrorKind, AppSettings,
ArgSettings}` are now `non_exhaustive`.
2021-12-13 12:11:00 -06:00
Ed Page
be223df828 fix(ci): Correct release lints
I'm assuming we won't have a negative performance impact by removing
`impl Copy for Id` because the compiler would inline the `clone()`s and
turn them into copies.

Addresses problems from #3164
2021-12-13 09:41:22 -06:00
Pavan Kumar Sunkara
ac751c2721
Merge pull request #3164 from epage/lint
chore(ci): Lint release builds
2021-12-13 15:39:16 +00:00
Ed Page
da0fe8f325 chore(ci): Lint release builds 2021-12-13 09:28:42 -06:00
Ed Page
b55ffdd0ce
Merge pull request #3154 from rhysd/fix-unused-warning
Fix unused parameter warning
2021-12-13 09:27:29 -06:00
Ed Page
b0f1750e81
Merge pull request #3041 from fishface60/master
Rewrite Multicall handling to just strip path off argv0
2021-12-13 09:21:59 -06:00
Ed Page
0b9aa487f6
Merge pull request #3163 from epage/docs
docs: List out each API
2021-12-13 09:07:30 -06:00
Ed Page
81f3bd794a docs: List out each API
This builds on #3149
2021-12-13 08:56:56 -06:00
Ed Page
7695ea2ce0
Merge pull request #3162 from PatrickNicholas/master
examples: Fix typo
2021-12-13 08:49:26 -06:00
p4tr1ck
f3afcee855 examples: Fix typo 2021-12-13 22:34:08 +08:00
Ed Page
2132b1f52a
Merge pull request #3158 from epage/docs
Expand clap_generate's documentation
2021-12-13 08:21:35 -06:00
Pavan Kumar Sunkara
36313b779f
Merge pull request #3161 from DerZade/master
docs: Fix copy paste error in example
2021-12-13 12:10:51 +00:00
DerZade
7c60180e24 docs: Fix copy paste error in example 2021-12-13 11:41:12 +01:00
Richard Maw
38b9645bed fix: Windows Multicall support
The executable suffix is unconditionally stripped off the file path
so that the file name matches subcommands names
without having to add the EXE suffix on different platforms.
2021-12-12 22:08:25 +00:00
Richard Maw
17c64ef42b fix: Example typo 2021-12-12 22:08:25 +00:00
Richard Maw
e3d355fa85 feat: Make Multicall just strip dir from argv0 2021-12-12 22:08:25 +00:00
Ed Page
87d4400f1a docs(readme): Expand generate's readme
Modeled it after clap's README.

The lib.rs is written in a way that cause the example to be merged in.
2021-12-11 19:01:50 -06:00
Ed Page
b5cc5f0c5b docs(readme): Fix name of clap_generate 2021-12-11 18:59:28 -06:00
Ed Page
e647b643cf docs(contrib): Generate-specific notes 2021-12-11 18:55:50 -06:00
Ed Page
378e8d733d
Merge pull request #3150 from japert/improve-subcommand-deprecation-message
Improve `SubCommand` deprecation message.
2021-12-11 17:42:03 -06:00
Janis Peukert
1f51e8cb2f docs: Clarify deprecation message for SubCommand
Only `SubCommand` is deprecated, not `Subcommand`.
This new deprecation message mentions this ambiguity.

Resolves #3147.
2021-12-11 14:47:08 -08:00
rhysd
b498876cd8 fix: Fix unused parameter warning 2021-12-12 00:44:14 +09:00
Ed Page
f7af296a8c docs(readme): Link out to clap-generate 2021-12-11 09:12:59 -06:00
Ed Page
8bb71415af docs(readme): Consistently use crates.io links 2021-12-11 09:12:26 -06:00
Ed Page
fe1e1a6a86
Merge pull request #3149 from vi/patch-1
docs: Fix numbers of list entries in FAQ.md
2021-12-11 09:06:06 -06:00
Pavan Kumar Sunkara
bbc9db198f
Merge pull request #3157 from isudzumi/patch-1
docs: Fix pacman-like interface example link
2021-12-11 14:23:33 +00:00
Hiroaki ITO
c2dc425784
docs: Fix the pacman-like interface example link 2021-12-11 22:22:09 +09:00
Pavan Kumar Sunkara
534bb27762
Merge pull request #3153 from rhysd/id-in-assertions
feat: Include argument ID in UTF-8 assertion messages
2021-12-11 13:08:56 +00:00