Commit graph

5013 commits

Author SHA1 Message Date
Daniel Eades
7f71d642cd style: prefer 'char' to 'str' for single character patterns 2022-01-04 09:20:08 -06:00
Ed Page
15704dcaff fix(parser): Ignore Last when checking Hyphe Values
This was found with #3249
2022-01-04 09:16:03 -06:00
Ed Page
e6ee585a4b fix: Clarify short rejection in debug 2022-01-04 09:00:13 -06:00
Ed Page
bcbe126b4d chore: Release 2022-01-03 18:53:28 -06:00
Ed Page
d392b88bd5 chore: Release 2022-01-03 12:12:28 -06:00
Ed Page
1a19d48765 docs: Update changelog 2022-01-03 12:11:11 -06:00
Ed Page
3782d8e728
Merge pull request #3247 from epage/len
fix: Don't panic when getting number of values
2022-01-03 12:08:45 -06:00
Ed Page
5c829ffa58
Merge pull request #3246 from epage/warn
fix(derive): Don't enit warnings
2022-01-03 11:55:16 -06:00
Ed Page
e5806830f3 fix: Don't panic when getting number of values
I was tempted to remove the exact-size nature.  Wouldn't be breaking
since it only panics but decided to go ahead and do this for now.

Fixes #3241
2022-01-03 11:53:59 -06:00
Ed Page
6b9ae5404c fix(derive): Don't enit warnings
We missed covering `Args` warnings when using struct variants.

Fixes #3245
2022-01-03 11:35:34 -06:00
Ed Page
b0cb2057ea docs(derive): Include name magic attribute
Inspired by #3242l
2022-01-03 06:33:53 -06:00
Ed Page
06f24b174a
Merge pull request #3243 from intgr/fix-clap_complete-documentation-imports
docs(complete): Fix imports in documentation
2022-01-03 06:27:04 -06:00
Marti Raudsepp
f10c5d18d9 docs(complete): Fix imports in documentation
Use `shells::Bash` instead of `generators::Bash`
2022-01-02 21:10:18 +02:00
Ed Page
879219a73d
Merge pull request #3240 from epage/heck
chore: Upgrade heck
2022-01-01 21:12:20 -06:00
Ed Page
42f6c72caa chore: Upgrade heck 2022-01-01 20:31:53 -06:00
Ed Page
3bb33387af docs(derive): Remove redundant setting 2022-01-01 19:51:17 -06:00
Ed Page
a01b0c813c chore(gh): Automate release creation 2022-01-01 12:43:24 -06:00
Ed Page
c01ebbac17 chore: Release 2021-12-31 14:35:02 -06:00
Ed Page
bc951e4e53 chore: Release 2021-12-31 13:37:28 -06:00
Ed Page
0aa5fd2e69
Merge pull request #3236 from epage/complete
fix(complete): Better organize the API
2021-12-31 13:36:32 -06:00
Ed Page
19b59a2df8 fix(complete): Better organize the API 2021-12-31 13:25:09 -06:00
Ed Page
8d73a0e80f chore: Release 2021-12-31 12:23:47 -06:00
Ed Page
24a2f3a901
Merge pull request #3235 from epage/complete
fix(complete): Give crates more specific names
2021-12-31 12:22:58 -06:00
Ed Page
88a335ff97 fix(complete): Give crates more specific names
`clap_generate` originally intended to be "generate anything".  With
`fig`, we already broke one part out.  With #3174's man support, we are
also looking at keeping it separate:
- More freedom to iterate on the API
- Uniqueness (and potential weight) of its dependencies
- man generation is normally more for distribution while completions are
  a mix of being distributed with the app or the app generating the
  completions (which will be exacerbated if we move most completion
  parsing logic to be in Rust)

So `clap_generate` is having a lot more limited of a role than the
original name conveys.   I worry the generic name will be a hindrance to
people discovering and using it (yes, documentation can help but there
are limits).

I hesitated because we are on the verge of releasing 3.0. However, doing
it even later will be even more disruptive because more people will be
using it (crates.io lists ~70 people using `clap_generate`).

To ease things, we are still releasing `clap_generate` as a wrapper
around `clap_complete`.
2021-12-31 12:03:29 -06:00
Ed Page
2d7dc1ff8f chore: Release 2021-12-30 15:00:19 -06:00
Ed Page
5360ffad78
Merge pull request #3233 from epage/ref
docs(derive): Link to ref from traits
2021-12-30 14:59:13 -06:00
Ed Page
29d4508e2a docs(derive): Link to ref from traits
This is to help with #3189
2021-12-30 14:41:26 -06:00
Ed Page
ea02f6125d chore: Release 2021-12-30 14:28:32 -06:00
Ed Page
e20c034b23 Merge pull request #3232 from epage/version
fix(help): Prefer short version over long version
2021-12-30 12:41:18 -06:00
Ed Page
889a70ebac fix(help): Prefer short version over long version
When we got #3193, we decided in #3196 that `--help` will give a summary
for other commands (`subcmd --help` in this case) but not show the long
version of the output for that other command.

Now with #3215, I think the case is similar for `--help` not showing the
long version but instead preferring the short version and encouraging
people to run `--version`.

Originally. clap only showed the short version or nothing.  This was
changed in #2369 without fanfare to prefer the long version over short.
Now are we preferring short version over the long version always, just
like all other help.

Fixes #3215
2021-12-30 12:21:19 -06:00
Ed Page
81c636c4b7
Merge pull request #3231 from epage/hardbreak
Revert "Remove {n} support"
2021-12-30 12:14:23 -06:00
Ed Page
e5fbdc9b95 Revert "Remove {n} support"
This reverts commit 333b993481.

PR #1810's motivation was effectively "this is redundant with `\n`".
That is a fine motivation.  Unfortunately, we don't have a way to force
a hard break in `clap_derive`.  #2389 should help with this eventually
but we shouldn't hold up 3.0 to get that ready.  So in the mean time, we
are restoring `{n}`.

We have #3230 for tracking the re-removal of it.
2021-12-30 11:44:45 -06:00
Ed Page
f596bb3ce8 docs(tutorial): Fix another internal link 2021-12-29 18:07:11 -06:00
Ed Page
06866ff1b4
Merge pull request #3229 from emielvanseveren/master
Fix broken internal link
2021-12-29 18:06:32 -06:00
Emiel Van Severen
657f32a59b
Fix broken internal link 2021-12-30 01:00:29 +01:00
Ed Page
ff713d5ae5 chore: Release 2021-12-27 15:57:27 -06:00
Ed Page
a58c1640a2
Merge pull request #3225 from epage/override
fix: Remove overriden occurrences as we go
2021-12-27 15:55:34 -06:00
Ed Page
771a44bcef fix: Remove overriden occurrences as we go
This allows two overriding args to interact with each other mid-line.
This was broken in 7673dfc / #1154.  Before that, we duplicated the override
logic in several places.

Now we plug into the start of a new arg which allows us to do this
incrementally without making the logic complex or inefficient, thanks to
prior refactors.

Fixes #3217
2021-12-27 15:32:37 -06:00
Ed Page
c54ea7f4c4 refactor: Propagate AllArgsOverrideSelf during build
This will have a slight performance hit as `AllArgsOverrideSelf` will
allocate a single-element `Vec` per `Arg`.  This can be lessened for
positional and multiple occurrences by shifting those checks up into the
propagation check.

Long term, I'd like to see all of the `Arg`-in-`App` settings switch to
this which will make it easier for callers, like completions and man
pages, to figure out whats going on without duplicating the logic.

Short term, this is motivated by wanting to change the override logic to
accomodated interleaved overrides from #3217.  Moving this logic will
make it easier to change the override logic.
2021-12-27 15:04:07 -06:00
Ed Page
cb393e4439 refactor: Always inc occurrences before adding values
This is the logical order people think in terms of (`--foo` comes before
`val` in `--foo val`). This also opens things up for using occurrence
incrementing as a place to handle occurrence transitions, like
overrides.
2021-12-27 15:03:02 -06:00
Ed Page
d7f27e8732 refactor: Harden against occur/val ordering
This makes some naming more explicit and allows us to increment
occurrences before adding values (which is the logical mental order and
allows other improvements).
2021-12-27 14:50:50 -06:00
Ed Page
a0ab35d678
Merge pull request #3224 from epage/test
test: Show more detailed failures
2021-12-27 14:21:31 -06:00
Ed Page
2d1dfae318 refactor: Clarify MatchArg::all_val_groups_empty 2021-12-27 14:21:04 -06:00
Ed Page
9c6c0174d2 test: Show more detailed failures 2021-12-27 13:57:38 -06:00
Ed Page
64da127671
Merge pull request #3223 from epage/test
test: Panic, rather than exit, on error
2021-12-27 13:25:44 -06:00
Ed Page
bfc486501a test: Panic, rather than exit, on error
Working on a fix for #3217 and can't see what is failing because the
test process exits.
2021-12-27 12:56:15 -06:00
Ed Page
b842dff443
Merge pull request #3214 from justjavac/patch-1
doc: Fix link to 'Configuring the Parser'
2021-12-24 05:51:58 -06:00
迷渡
9faec11b84
docs: Fix link to 'Configuring the Parser'
Signed-off-by: 迷渡 <justjavac@gmail.com>
2021-12-24 12:41:09 +08:00
Ed Page
3499b6b4b6 docs(changelog): Fix typo 2021-12-23 16:07:29 -06:00
Ed Page
8d94739de4 chore: Release 2021-12-23 14:28:46 -06:00