Commit graph

325 commits

Author SHA1 Message Date
Ed Page
5fb1b25799
Merge pull request #4883 from nyurik/happy-clippy
chore: Make Clippy happy
2023-05-03 21:13:47 -05:00
Yuri Astrakhan
1dc6304fcf chore: Order trait impl same as trait 2023-05-03 22:01:16 -04:00
Yuri Astrakhan
ebbdce4820 chore: Make Clippy happy 2023-05-03 21:56:07 -04:00
Yuri Astrakhan
797c23c415 chore: Inline format args using clippy fix
This command cleaned up all the format args,
making code significantly shorter and more readable.

```
cargo clippy --workspace --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2023-05-03 21:49:11 -04:00
Yuri Astrakhan
47cbc5f247 chore: Deduplicate powershell code complete
Makes powershell code more concise
2023-05-03 21:02:30 -04:00
Ed Page
43591bc1ee chore: Release 2023-04-21 07:42:44 -05:00
Ed Page
9bda2ac8a0 docs: Update changelog 2023-04-21 07:42:33 -05:00
Huan-Cheng Chang
a379bae895 fix: Escape special characters properly for zsh
Signed-off-by: Huan-Cheng Chang <changhc84@gmail.com>
2023-04-20 21:52:36 +02:00
Ed Page
feddd124b0 style: Move away from banned fns 2023-03-30 02:18:00 -05:00
Ed Page
8fc65e28b6 chore: Release 2023-03-28 02:19:08 -05:00
Ed Page
2852653656 chore: Release 2023-03-27 19:41:39 -05:00
Ed Page
2bb4146374 chore: Release 2023-03-25 03:56:28 -05:00
Ed Page
ea4dada1e4 fix(lex): Allow reporting errors for non-UTF8 longs 2023-03-25 03:42:04 -05:00
Ed Page
6419a0d937 perf!(lex): Build faster by removing os_str_bytes
We are doing direct transmutes between `OsStr` and `[u8]`.
https://github.com/rust-lang/rust/pull/95290 would make this natively
supported but I got tired of waitin for it.

This only saves about 1/4s off of `cargo build`.

This took 2.9 KiB off of `cargo bloat --release --example git`
2023-03-25 01:59:24 -05:00
Ed Page
d9a641bcc8 docs: Consistently use console fence type 2023-03-24 21:33:49 -05:00
mochi33i
7c6cf81476 docs(clap_complete): The file name of the command in the clap_complete example documentation was not supported, so it has been updated 2023-03-27 23:24:50 +09:00
Ed Page
e78bba0ec5 chore: Release 2023-03-16 10:42:06 -05:00
Ed Page
dec82598b2 chore: Upgrade trycmd 2023-03-16 06:07:46 -05:00
Ed Page
6c0600a031 chore: Fully specify dependencies 2023-03-16 06:07:08 -05:00
renovate[bot]
8469554c17
chore(deps): update compatible (dev) (#4741)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-01 04:51:19 +00:00
Ed Page
84a9b53cee chore: Release 2023-02-27 04:20:28 -06:00
Ed Page
9fa48d5f92 docs: Update changelog 2023-02-27 04:20:07 -06:00
XiaoXiaoSN
0f3e729358 feat(complete): Support to run ZSH completion as a script 2023-02-27 23:23:50 +08:00
Ed Page
cdb33b6ad2 test(complete): Adjust bash snapshot 2023-02-24 07:40:24 -06:00
Ed Page
2deb372195 chore: Release 2023-02-23 11:56:20 -06:00
Ed Page
c064da01c9 docs: Update changelog 2023-02-23 11:56:12 -06:00
Ed Page
77803337f8
Merge pull request #4612 from davvid/zsh-multi-length-arguments
clap_complete: fix support for two multi-length arguments in zsh
2023-02-23 11:55:17 -06:00
Ed Page
953e2dcd34 docs: Remove remaining references to clap attribute 2023-02-18 18:42:07 -06:00
Ed Page
fb9435d026 chore: Release 2023-02-15 10:27:15 -06:00
Martin
704d0e7a4f chore: Make format!() calls more readable 2023-01-29 19:14:47 +00:00
Ed Page
90c042eeae chore: Release 2023-01-23 13:05:20 -06:00
Ed Page
4f638b5c75 docs: Update changelog 2023-01-23 13:05:15 -06:00
Fredrik Jansson
3426310d8e fix: Bash test cases 2023-01-23 19:20:09 +01:00
Fredrik Jansson
8b455d28e7 fix: Make cmd a local var in bash completion 2023-01-23 19:07:15 +01: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
a41ca2edb0 docs: Update changelog 2023-01-13 07:13:28 -06:00
David Aguilar
170bd59111 fix(complete): Handle multi-valued arguments
zsh completions for commands that have multiple Vec arguments require
special care.

We can have two Vec args separated with a value terminator.
We can also have two Vec args with no value terminators specified
where the final arg uses 'raw' and thus requires '--' to be used.

The 2nd of these scenarios requires special handling to avoid
emitting a duplicate '*:arguments' completion entry.

Currently, the zsh completions generate an error in this scenario:

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

We already use the '-S' option when calling _arguments.
This option makes it so that completion stops after '--' is encountered.
This means that the handling for trailing 'raw' arguments does not need
to specified.

Special-case multi-valued arguments so that we can skip emitting
the final multi-valued argument if a previous multi-valued argument
has already been emitted.

Closes #3022
Signed-off-by: David Aguilar <davvid@gmail.com>
2023-01-10 14:39:33 -08: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
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
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
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
renovate[bot]
acfc493a35
chore(deps): update compatible (dev) 2023-01-01 02:25:24 +00:00
Ed Page
0eccd556ac chore: Release 2022-12-22 12:40:15 -06:00
renovate[bot]
9b2b718df6
chore(deps): update dev 2022-12-01 21:38:13 +00:00
Ed Page
3262016c26 chore: Release 2022-11-24 11:40:15 -06:00
Ed Page
623ccbc152 style: Make clippy happy 2022-11-24 08:05:21 -06:00
Hugo Osvaldo Barrera
d169849330 docs: Clarify mention of example elsewhere
This points to "the example above", but there's no example above when
this gets rendered in docs.rs:

    https://docs.rs/clap_complete/latest/clap_complete/generator/fn.generate.html

I suppose this reference is just stale since moving docs from a single
markdown file or something similar.
2022-11-19 12:22:37 +01:00
Ed Page
c75b81eeb8 chore: Release 2022-11-07 07:39:49 -06:00
Ed Page
28324d8df7 docs: Update changelog 2022-11-07 07:39:36 -06:00
Ed Page
571f45080e
Merge pull request #4447 from tmccombs/guess-shell
Add support for determining current shell from environment
2022-11-07 07:38:51 -06:00
Ed Page
b4b94af0f8 chore: Release 2022-11-07 06:24:02 -06:00
Thayne McCombs
86db119153 feat(complete): Support getting shell from env
Add functions for getting the Shell from a path and for getting the
current shell form environment variables.

Closes: #4446
2022-11-06 23:39:55 -07:00
Ed Page
a24fb589eb chore: Update trycmd 2022-11-04 10:27:57 -05:00
Ed Page
996636d56f chore: Release 2022-10-18 14:37:53 -05:00
Ed Page
3e23cd102f fix: Require release versions of clap 2022-10-18 14:36:44 -05:00
dependabot[bot]
f0d971562a
chore(deps): bump snapbox from 0.3.3 to 0.4.0
Bumps [snapbox](https://github.com/assert-rs/trycmd) from 0.3.3 to 0.4.0.
- [Release notes](https://github.com/assert-rs/trycmd/releases)
- [Changelog](https://github.com/assert-rs/trycmd/blob/main/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/trycmd/compare/snapbox-v0.3.3...snapbox-v0.4.0)

---
updated-dependencies:
- dependency-name: snapbox
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-01 18:58:27 +00:00
Ed Page
eeafb2574b docs(complete): Don't use deprecated API 2022-09-29 16:11:03 -05:00
Ed Page
80fb67edaa chore: Release 2022-09-29 12:08:47 -05:00
Ed Page
83db04c0c3 docs: Update changelog 2022-09-29 12:08:40 -05:00
Martin von Zweigbergk
33fa7c4c19 fix(complete): Fix command alias and Bash
With the previous fixes for #4273 and #4280 in place, it's now easy to
add support for subcommand aliases, which this commit does. This
addresses #4265 for Bash.
2022-09-29 08:58:32 -07:00
Martin von Zweigbergk
9ee45f7f3d fix(complete): Fix git diff log <TAB> for Bash
This continues the work started with the fix for #4273. There was
another bug caused by using the subcommand names without considering
their position in the argument list. If the user enters `git diff log
<TAB>`, we build up a string that identifies the subcommand. We ended
up making the string `git__diff__log` in this case because we appended
`__log` without considering the current state. Since `git__diff__log`
does not correspond to an actual command, we wouldn't provide any
suggestions.

This commit restructures the code so we walk subcommands and
subsubcommands in `bash.rs`. While walking those, we build up a list
containing triples of the parent `$cmd` name (e.g. `git__diff`), the
current command's name (e.g. `log`), and the `$cmd` for the current
command. We then build the shell script's case arms based on that
information.

We could instead have fixed #4280 by using the second element in the
pair returned from `utils::all_subcommands()` (a stringified list of
the subcommand path) instead of the first one. However, that would not
have helped us solve #4265.

Closes #4280
2022-09-29 08:58:32 -07:00
Martin von Zweigbergk
ea264fde16 fix(complete): Fix git diff git <TAB> for Bash
Early in the Bash-completion script, we build up a string that
identifies the command or subcommand. When we see the top-level
command's name (e.g. `git`) we set the command so far to that
value. We do that regardless of where in the argument list it
appears. For example, if the argument list is `git diff git`, we set
the current command to `git` when run into it the second time. We
therefore suggest arguments to the top-level command afterwards, which
is not correct.

This patch fixes that by also considering the string that identifies
the command so far, so we only set the overall command to `git` if the
command so far is the empty string.

This is actually just a step on the way to getting completion to work
for aliases of subcommands.

Closes #4273
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
35b5f9b276 refactor(complete): Remove an always-true check
The `text` variable here is clearly never empty, so don't check if it
is.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
9c59c69bb0 refactor(complete): Remove unnecessary early return
There seems to be little reason to return early with an empty list
when there are no subcommands, instead of going through the loop 0
times and then returning the empty list.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
8d0ef124e0 test(complete): Include a visible command alias
Only zsh includes completion for visible aliases of subcommands. Let's
show that in tests.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
5020d739d5 refactor(complete): Add an alias for the subcommand
I want to add support for completion of arguments for aliased
subcommands so it's nice to have an example to test on.
2022-09-29 08:39:49 -07:00
Martin von Zweigbergk
6bc8d2632c refactor(complete): Add a subcommand to examples
It's useful when testing to have a subcommand in the examples.
2022-09-29 08:39:17 -07:00
Martin von Zweigbergk
8b33da3138 fix(complete): Make the two examples consistent
The derive-based example has a `///` comment on one argument, which
ends up as a description for the argument in the generated completion
scripts. Let's switch to `//` so the two scripts produce the same
output (except for the binary name), so they're easy to compare.
2022-09-29 08:37:03 -07:00
Martin von Zweigbergk
59270b1c81 fix(complete): Make example commands match binary
The example binaries were renamed in 89c2b3bb0d, but the commands in
them were not, making the generated completion scripts not work
(because we use the command name as binary name in the examples).
2022-09-29 08:34:19 -07:00
Ed Page
bf42ff04d5 chore: Release 2022-09-28 15:34:33 -05:00
Ed Page
824f6589ad docs: Update changelog 2022-09-28 15:34:25 -05:00
Ed Page
7b886d2c63
Merge pull request #4278 from intgr/zsh-completion-fix-multiple-args-handling
fix(complete): Fix zsh handling of multiple arguments
2022-09-28 15:33:42 -05:00
Marti Raudsepp
89cae3a2b3 fix(complete): Fix handling of multiple arguments 2022-09-28 23:02:31 +03:00
Ed Page
8aafddff01 docs(complete): Ensure examples work
Fixes #4272
2022-09-28 14:34:56 -05:00
Ed Page
3a74d82376 chore: Release 2022-09-28 12:00:48 -05:00
Ed Page
a82029c707 chore: Release 2022-09-20 16:30:29 -05:00
Ed Page
af64699912 chore: Release 2022-09-20 16:28:27 -05:00
Ed Page
7a5dad89ff feat(help): Break out help feature flag
This removes auto-generated help, saving about 50 KiB.
2022-09-19 11:54:10 -05:00
Ed Page
c165b601ac perf: Switch to &'static str by default
Originally, clap carried a lifetime parameter.  When moving away from
that, we took the approach that dynamically generated strings are always
supported and `&'static str` was just an optimization.

The problem is the code size increase from this is dramatic.  So we're
taking the opposite approach and making dynamic formatting opt-in under
the `string` feature flag.  When deciding on an implementation, I
favored the faster one rather than the one with smaller code size since
small code size can be gotten through other means.

Before: 567.2 KiB, 15.975 µs
After: 541.1 KiB, 9.7855 µs
With `string`: 576.6 KiB, 13.016 µs
2022-09-16 16:44:39 -05:00
Roland Fredenhagen
a2cf7f1dea fix: Tests/clippy/errors bash dynamic completion 2022-09-07 20:25:06 -05:00
Ed Page
bffce7f57a fix: Deprecate Command::trailing_var_arg
Now that we have it on `Arg`, we don't need it on `Command`
2022-09-06 19:41:17 -05:00
Ed Page
0e915e0d3a docs(derive): Update for new attributes 2022-09-02 15:39:13 -05:00
Roland Fredenhagen
8ab649e929
fix(complete): Escape , in completions for fish 2022-09-02 14:47:04 +02:00
Roland Fredenhagen
028a4cd0dc
test(complete): Disable normalization of \ to /
This allows easier testing, as the generated completion files can be
sourced directly.
2022-09-02 14:46:12 +02:00
Ed Page
6bd4fee69f chore: Update dependencies 2022-09-01 07:09:32 -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
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
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
b4b121d3a4 fix(derive): Remove deprecated arg_enum attribute 2022-08-26 13:34:16 -05:00
Andrew Shu
729406661c refactor(complete): Clean up help completion
* Manual subtree copy to ensure correct behavior and settings
* Always set ExpandHelpSubcommandTrees in Command::build
* Remove redundant logic
2022-08-25 15:43:27 -07:00
Andrew Shu
fdcee9313f feat(complete): Add completion for help subcommands
Adds parser flags to toggle whether to run the
expensive clone logic for completions case.

Help completion will only suggest subcommands, not args.

clap_complete generator sets the flag.
2022-08-25 13:58:08 -07:00
Ed Page
df7616b820 fix(help): Match v3 usage for optional positionals 2022-08-25 13:13:09 -05:00
Ed Page
e00abc6905 refactor(help): Consolidate arg suffix rendering
This ended up favoring the help implementation
2022-08-25 13:01:27 -05:00
Ed Page
c6155f62d5 feat: Open the door for user styling in the future
This added about 10 KiB to the `.text` which I cannot explain why
2022-08-24 18:17:42 -05:00
Ed Page
276c75cc08 fix: Don't pollute root with str types 2022-08-23 13:12:06 -05:00
Ed Page
1bbf07e574 fix: Prefer more usable &str for reflection
The downside is we can't skip allocations with
- `ValueEnum` default values
- Vaid subcommands

Otherwise, this is a big ergonomic win.
2022-08-22 14:56:16 -05:00
Ed Page
85f541d789 fix: Switch to owned types
Impact:
- Binary size: 556.6 KiB to 578.4 KiB
- build time: 6.4950 us (7% slower)
- parse time: 7.7256 us
- parse sc time: 8.1580 us (5% faster)

Fixes #1041
Fixes #2150
2022-08-22 14:55:55 -05:00
Ed Page
8cc164dafb fix!: Remove lifetime from PossibleValue
Another step towards #1041

This isn't the long term type for `PossibleValue::help`, I just wanted
to get the lifetime out of the way first before figuring out how help
will work.
2022-08-19 12:44:29 -05:00
Ed Page
43e961d24f style: Address clippy 2022-08-11 16:07:58 -05:00
Ed Page
3390adf0d3 chore: Bump MSRV to 1.60.0
While at it, this cleans up all of the features.  For some reason, I
couldn't do `dep:clap_derive` though.
2022-08-10 21:32:06 -05:00
Ed Page
f70ebe89a7 fix!: Require explicit help/version disabling
Before we introduced actions, it required specific setups to engage with
claps version and help printing.  With actions making that more
explicit, we don't get as much benefit from our multiple, obscure, ways
of users customizing help

Before
- Modify existing help or version with `mut_arg` which would
  automatically be pushed down the command tree like `global(true)`
- Create an new help or version and have it treated as if it was the
  built-in on (I think)
- Use the same flags as built-in and have the built-in flags
  automatically disabled
- Users could explicitly disable the built-in functionality and do what
  they want

Now
- `mut_arg` no longer works as we define help and version flags at the
  end
- If someone defines a flag that overlaps with the built-ins by id,
  long, or short, a debug assert will tell them to explicitly disable
  the built-in
- Any customization has to be done by a user providing their own.  To
  propagate through the command tree, they need to set `global(true)`.

Benefits
- Hopefully, this makes it less confusing on how to override help
  behavior.  Someone creates an arg and we then tell them how to disable
  the built-in
- This greatly simplifies the arg handling by pushing more
  responsibility onto the developer in what are hopefully just corner
  cases
- This removes about 1Kb from .text

Fixes #3405
Fixes #4033
2022-08-10 20:33:21 -05:00
Ed Page
64639aa81c style: Make clippy happy 2022-08-10 11:41:27 -05:00
Ed Page
8ed35b4d9f fix: Provide convenient access for common cases 2022-08-05 12:06:54 -05:00
Ed Page
32f308d4ef fix!: Make is_multiple_values private
multiple_values is now just book keeping for the builder, instead people
should look to actions and `num_args`.

The meaning for it was a little weird anyways.
2022-08-04 15:21:10 -05:00
Ed Page
6e1ca59ec1 fix!: Make is_takes_value_set private
At this point, it is an implementation detail to help with book keeping
within the builder.
2022-08-04 14:44:14 -05:00
Ed Page
52ec1f92e9 fix: Clarify that get_num_args is safe to call
The only time it won't be initialized is before `_build`.  This is possible because
of #4027

I wish I could just put the `expect` inside the call but I'm worried
about allowing people to build stuff on top of clap.
2022-08-04 14:21:53 -05:00
Ed Page
ba15b5f430 fix!: Rename Arg::number_of_values to Arg::num_args 2022-08-03 14:45:47 -05:00
Ed Page
470531b515 fix!: Replace multiple_values with number_of_values
This reduces ambiguity in how the different "multiple" parts of the API
interact and lowrs the amount of API surface area users have to dig
through to use clap.

For now, this is only a matter of cleaning up the public API.  Cleaning
up the implementation is the next step.
2022-08-01 15:50:23 -05:00
Ed Page
76bff6f34e fix!: Remove rest of deprecated APIs
Fixes #4009
2022-08-01 15:21:33 -05:00
Ed Page
41535d5c46 feat: Extend number_of_values to support min/max per occurrence 2022-07-28 16:52:25 -05:00
Ed Page
5f20fe1930 docs: Shift focus from takes_value to actions 2022-07-26 14:50:51 -05:00
Ed Page
6f03b4f948 fix!: Remove multiple occurrences in favor of Append/Count
For num_vals and friends, this only implements hacks until #2688

Fixes #3021
2022-07-25 13:23:43 -05:00
Ed Page
8aa7ab3e16 chore: Update version
The main goal is to reduce the risk of people developing on the wrong
release, assuming they are using something like starship to raise the
visibility of the crate version.
2022-07-23 21:43:37 -05:00
Ed Page
08e8642a8c
Merge pull request #3976 from epage/attrib
fix(derive)!: Remove value_parser/action defaulted attributes
2022-07-22 20:25:09 -05:00
Ed Page
6ecb7310a8 fix(derive)!: Remove value_parser/action defaulted attributes 2022-07-22 20:07:47 -05:00
Ed Page
122b562e6b fix!: Change default actions to Set/SetTrue
This is in prep for removing StoreValue/IncOccurrences
2022-07-22 20:00:47 -05:00
Ed Page
24735e3a1d fix!: Pull AppSettings out of API
Part of #3021
2022-07-22 16:05:54 -05:00
Ed Page
f10809f0cc fix!: Remove possible_values 2022-07-21 15:54:26 -05:00
Ed Page
fbd6e19f05 fix(complete)!: Remove deprecated Shell::possible_values 2022-07-21 15:40:40 -05:00
Ed Page
ff0796b014 fix(derive)!: Remove old derive names 2022-07-21 12:57:12 -05:00
Ed Page
6286339f81 docs(complete): Make example consistent
Fixes #3883
2022-07-11 15:20:45 -05:00
Ed Page
b4a1362486 chore: Release 2022-06-28 08:04:18 -05:00
Ed Page
5ba41d775c docs(license): Update years/holders
Without copyright assignment, everyone owns their own copyright, so
tried to reflect that.

See #3875
2022-06-27 12:55:09 -05:00
Ed Page
3823df9bbe chore: Release 2022-06-21 09:32:04 -05:00
Ed Page
ae78f88d48
Merge pull request #3852 from epage/msrv
chore: Bump MSRV from 1.56.0 to 1.56.1
2022-06-17 09:23:06 -05:00
Ed Page
82d70d82c4 chore: Bump MSRV from 1.56.0 to 1.56.1
Being a patch release, I'm fine doing this outside of a minor release.
This avoids us having to deal with indexmap having a higher MSRV.
2022-06-17 09:01:45 -05:00
Tshepang Mbambo
806f634bfa chore: trim Cargo manifest fields whose values are defaults
See...
- https://doc.rust-lang.org/cargo/reference/manifest.html?#the-documentation-field
- https://doc.rust-lang.org/cargo/reference/manifest.html?#the-readme-field
2022-06-17 15:49:04 +02:00
Ed Page
ea3bd55993 test(complete): Ensure we infer path completions from value_parser
Looks like I forgot to add a test case for this.

I put this in `clap_complete` because I expect `ValueHint` to move here
as we move towards a plugin system.

Fixes #3840
2022-06-16 09:59:30 -05:00
Ed Page
650a29c18b chore: Release 2022-06-13 09:37:47 -05:00
Ed Page
4e56acffce chore: Release 2022-06-13 09:31:29 -05:00
Ed Page
9e38353442 fix(derive): Clarify ArgEnum as ValueEnum
We aren't enumerating arguments but values for an argument, so the name
should reflect that.

This will be important as part of #1807 when we have more specific
attribute names.
2022-06-08 11:14:09 -05:00
Ed Page
14a62e11fd fix(parser): Deprecate multiple_occurrences
Fixes #3772
2022-06-08 09:54:23 -05:00
Ed Page
86a162d1bb fix(parser): Deprecate occurrences_of
This mostly exist for
- Knowing of the value came from the command-line but we now have
  `ArgMatches::source`
- Counting the number of flags but we now have `ArgAction::Count`
2022-06-07 13:30:32 -05:00
Ed Page
a712adefcd fix(parser): Deprecate value_of and friends 2022-05-25 12:57:11 -05:00
Ed Page
256643f8d3 fix: Deprecate possible_values 2022-05-25 12:57:11 -05:00
Ed Page
177511dab1 fix: Deprecate validator / validator_os
`validator_regex` is being ignored for now as I await on a comment
period for #3743
2022-05-25 12:57:11 -05:00
Ed Page
852a1b15d4 fix(help): Show value_parser's PossibleValues 2022-05-20 19:59:36 -05:00
Ed Page
2abb6804d3 fix: Switch to 2021 edition 2022-05-18 10:35:30 -05:00
Ed Page
d827364ea9 style: Normalize manifests 2022-05-18 10:33:37 -05:00
Ed Page
272334b26a fix: List rust-version for all crates 2022-05-18 10:08:10 -05:00
Ed Page
0033bf60c1 style: Address clippy complaints 2022-05-17 14:11:04 -05:00
Ed Page
f3d8ef248f feat(complete): Complete value_parser possible values 2022-05-16 15:08:47 -05:00
Ed Page
95698a4f31 chore: Release 2022-05-06 09:39:24 -05:00
Ed Page
3984e55363 docs(complete): Update changelog 2022-05-06 09:39:15 -05:00
Ed Page
b266e6d35d fix(complete): Complete visible, rather than hidden, values
In a refactor for #3503, one of the checks for `is_hide_set` got flipped
and we are completing hidden `PossibleValue`s rather than visible.

Fixes #3697
2022-05-06 09:14:32 -05:00
Ed Page
d3e36b1c90 fix(v4): Disallow leading dashes in long's
This is a step towards #3309.  We want to make longs and long aliases
more consistent in how they handle leading dashes.  There is more
flexibility offered in not stripping and it matches the v3 short
behavior of only taking the non-dash form.  This starts the process by
disallowing it completely so people will catch problems with it and
remove their existing leading dashes.  In a subsequent breaking release
we can remove the debug assert and allow triple-leading dashes.
2022-05-04 15:38:08 -05:00
Ed Page
0ecb6f4869 fix(builder): Fully recurse when building
Besides addressing the panic from assuming things were built when they
weren't, this should fix some completion issues for some people.

Fixes #3669
2022-04-30 20:02:06 -05:00