Commit graph

4753 commits

Author SHA1 Message Date
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
Ed Page
5a670ec436
Merge pull request #3212 from epage/conflict2
fix: Don't panic on lack of conflicts
2021-12-23 14:18:24 -06:00
Ed Page
3db09f4dd4 fix: Don't panic on lack of conflicts
Fixes #3197
2021-12-23 13:38:23 -06:00
Ed Page
02f4ff2115 refactor: Allow more conflicts to be reported 2021-12-23 11:18:22 -06:00
Ed Page
f24b9f50de refactor: Make it easier to get groups 2021-12-23 11:15:11 -06:00
Ed Page
a37f2908c8 docs(derive): Looks like optional isnt supported
According to #2587
2021-12-23 10:29:34 -06:00
Ed Page
653617d0fd docs(derive): Add flatten/subcommand for variants 2021-12-23 10:27:07 -06:00
Ed Page
28801dfbde
Merge pull request #3210 from epage/docs
docs(tutorial): Encourage `App::debug_assert`
2021-12-23 09:08:50 -06:00
Ed Page
ad127fcc53
Merge pull request #3205 from epage/unless
fix: Ensure we validate required-unless
2021-12-23 08:47:23 -06:00
Ed Page
5643dddf3e docs(tutorial): Encourage App::debug_assert 2021-12-23 08:41:52 -06:00
Ed Page
efca08341a docs(tutorial): Fix derive anchor links 2021-12-23 08:23:32 -06:00