Commit graph

6873 commits

Author SHA1 Message Date
Ed Page
9d1de20787 docs: Prefer get_flag over get_one::<bool>
Inspired by #4654
2023-01-23 09:23:38 -06:00
Ed Page
74a82d7085 chore: Release 2023-01-13 21:44:17 -06:00
Ed Page
06f392a0d2 docs: Update changelog 2023-01-13 21:44:12 -06:00
Ed Page
4d913fa4d1
Merge pull request #4639 from epage/error
fix(error): Try to soften unexpected argument/value errors
2023-01-13 21:42:45 -06:00
Ed Page
162a556dba fix(error): Try to soften unexpected argument/value errors
Adding "found" might seem minor but I feel it has a slight softening on the message.  It also maintains scanability as it is at the end and short.

As this is a one-off message change and not a styling issue to be consistent with, I think this is safe to put in a patch release.
2023-01-13 21:29:49 -06:00
Ed Page
34d856b449 chore: Release 2023-01-13 09:27:31 -06:00
Ed Page
889ca7a537 chore: Bump versions for 4.1 2023-01-13 09:24:37 -06:00
Ed Page
2bafb9b75d docs(contrib): Define a compatibility policy for help/error output 2023-01-13 07:19:30 -06:00
Ed Page
a41ca2edb0 docs: Update changelog 2023-01-13 07:13:28 -06:00
Ed Page
523adc20e7
Merge pull request #4635 from epage/stablize
feat: Stablize `ArgMatches::get_occurrences`
2023-01-13 06:52:30 -06:00
Ed Page
b4f111a978 feat: Stablize ArgMatches::get_occurrences
This let's you get an arguments values, grouped by the occurrence of the
argument.

Note: this does not stablize derive support.  That requires a blocking
change and can be enabled via `unstable-v5` flag.  See #4626 for an
exploration of how we can make this easier in the future.

Fixes #2924
2023-01-12 21:37:19 -06:00
Ed Page
72749a3a09
Merge pull request #4630 from eguiraud/patch-1
Prefer ok_or to ok_or_else in README example
2023-01-11 16:43:11 -06:00
Enrico Guiraud
84314614fb
docs: prefer ok_or to ok_or_else in README example
As suggested by clippy when using the example code.
2023-01-11 16:41:08 -06:00
Ed Page
37d03bb201
Merge pull request #4627 from tmccombs/macro-cleanup
refactor(derive): Clean up unnecessary noop parsing
2023-01-11 07:11:11 -06:00
Thayne McCombs
65f9e0d747 refactor(derive): Clean up unnecessary noop parsing
My guess is this was left over from switching to using the type based
API. The generated code for extracting values from `ArgMatches` had some
code that didn't actually do anything, like mapping over the identity
function, and wrapping a value in an `Ok` only to immediately use "?" on
it.
2023-01-11 01:38:36 -07:00
Ed Page
5345d6c332
Merge pull request #4625 from rhysd/fix-is-is
fix(doc): Fix typos in document of `ArgMatches` methods
2023-01-10 19:55:46 -06:00
rhysd
4b1f79b470 fix(doc): Fix typos in ArgMatches methods 2023-01-11 10:46:44 +09:00
Ed Page
b86c259ed0
Merge pull request #4624 from davvid/value-terminators
fix(completion): emit value terminators on zsh
2023-01-10 14:35:30 -06:00
Ed Page
e576c65dee style: Make clippy happy 2023-01-10 09:08:12 -06:00
Ed Page
084991f70a
Merge pull request #4600 from tmccombs/groups-derive
Add support for deriving grouped options for Vec<Vec<T>>
2023-01-10 08:43:36 -06:00
David Aguilar
58b0c504d8 fix(complete): Emit value terminators on zsh
Emit the user-defined value terminator into the zsh completion pattern
to avoid doubled rest-arguments definitions:

    $ my-app <TAB>
    _arguments:comparguments:325: doubled rest argument definition:
    *::second -- second set of of multi-length arguments:

https://github.com/clap-rs/clap/issues/3266#issuecomment-1007901407
noted that including the value terminator is one step towards a
robust solution for handling multiple multi-valued arguments.

This change does not yet handle automatically detecting when a value
terminator is needed, but it does add tests to ensure that
user-specified value terminators are used on zsh.

Related-to: #3022
Signed-off-by: David Aguilar <davvid@gmail.com>
2023-01-10 00:59:25 -08:00
David Aguilar
0b0306cc79 feat(api): Add Arg::get_value_terminator()
Expose get_value_terminator() for use by clap_complete.

Related-to: #3022
Signed-off-by: David Aguilar <davvid@gmail.com>
2023-01-10 00:38:56 -08:00
Ed Page
d0adade3dd
Merge pull request #4618 from epage/update
fix(derive): Allow update_from when explicit requireds used
2023-01-09 21:47:52 -06:00
Ed Page
50f033e6bc fix(derive): Allow users to override arg_required_else_help on sub-sub commands 2023-01-09 21:08:56 -06:00
Ed Page
af71ada3f4 fix(derive): Allow update_from when explicit requireds used
Fixes #4617
2023-01-09 20:52:46 -06:00
Ed Page
b9ae787d6b test(derive): Show update_from bug with explicit required 2023-01-09 20:52:45 -06:00
Ed Page
7b69dea24f test(derive): Unwrap, don't exit 2023-01-09 20:52:06 -06:00
Ed Page
9aa76fa12f docs: Update changelog 2023-01-09 14:03:47 -06:00
Ed Page
a2e8791bc4
Merge pull request #4615 from epage/MSRV
chore: Bump MSRV to 1.64.0
2023-01-09 13:55:48 -06:00
Ed Page
082d54a9dc style: Update for clippy 1.64 2023-01-09 12:38:55 -06:00
Ed Page
fa02111092 chore: Switch to workspace inheritance 2023-01-09 12:35:54 -06:00
Ed Page
f25fe5b3e0 chore: Bump MSRV to 1.64.0 2023-01-09 12:29:41 -06:00
Ed Page
fda2a961cb
Merge pull request #4614 from epage/fix
test(builder): Fix failing test
2023-01-09 12:14:39 -06:00
Ed Page
d745c32f4f test(builder): Fix failing test 2023-01-09 11:59:20 -06:00
Thayne McCombs
73df3d1a1e chore: Put Vec<Vec<_>> behave for derive behind unstable-v5 flag 2023-01-08 00:28:01 -07:00
Thayne McCombs
ccce3c3db5 test: Add test for opting out of Vec<Vec<T>> derive 2023-01-07 23:36:45 -07:00
Thayne McCombs
eaa9273f91 feat: Add support for deriving grouped options for Vec<Vec<T>>
Relates-To: #2924
2023-01-07 23:36:45 -07:00
Ed Page
ac6b4cdf34
Merge pull request #4610 from tgross35/patch-1
Fix example that as runtime panic. Relates to #3864
2023-01-06 19:48:25 -06:00
Trevor Gross
c062182e1e docs: fix example that as runtime panic. Relates to #3864
Relevant comment: https://github.com/clap-rs/clap/issues/3864#issuecomment-1374297155
2023-01-06 19:24:12 -05:00
Ed Page
7d57df5c89
Merge pull request #4609 from epage/error
fix(error): Try to polish/clarify messages
2023-01-06 17:26:25 -06:00
Ed Page
762b06fba4 fix(error): Try to polish/clarify messages
In text communication you need to balance
- Scannability, putting the most important information upfront
- Brevity so people don't get lost in the message
- Softness to help ease people through a frustrating experience

I feel we weren't doing great on the first two points, so tried to
iterate on the messages to improve them.  I hope we aren't suffering too
much on the third point as a side effect.
2023-01-06 17:01:36 -06:00
Ed Page
3e7ca92173 chore: Upgrade trycmd 2023-01-06 16:43:40 -06:00
Ed Page
689c77a682
Merge pull request #4602 from epage/errors2
fix(error): More closely match rustc's error style
2023-01-03 13:41:58 -06:00
Ed Page
68a7740fdc fix(error): Match rustc for giving more information 2023-01-03 13:22:35 -06:00
Ed Page
c2efb60a5f fix(error): Lowercase the start of error messages
This matches the rustc error style
2023-01-03 13:17:46 -06:00
Ed Page
e7d58b3daf
Merge pull request #4385 from epage/errors
fix(error): Be consistent with rustc diagnostic guidelines
2023-01-03 12:54:16 -06:00
Ed Page
7229047d78
Merge pull request #4514 from noritada/notes-on-cargo-env-vars
docs: Present other environment variable alternatives to `crate_name!`
2023-01-03 12:44:42 -06:00
Ed Page
206d2e47a6
Merge pull request #4601 from epage/short
fix(help): Remove extraneous text from built-ins
2023-01-03 12:43:39 -06:00
Ed Page
36bc641648 fix(help): Remove extraneous text from built-ins
This is an intermediate solution for #4408.  As there were no agreeed
upon goals, I went with what I felt read well and that I saw commonly
used on non-clap commands.

- "information" isn't really a necessary word.
- I originally favored `Print this help` but realied that doesn't read
  correctly in completions.
- Besides being shorter, the reason for the flipped short/long hint is
  it gives people the context they need for scanning, emphasizing
  "summary" and "more".

Fixes #4409
2023-01-03 11:02:26 -06:00
Ed Page
e7033f775f
Merge pull request #4515 from epage/wasm
chore(ci): Force setting of toolchain target
2023-01-03 09:42:52 -06:00