Commit graph

134 commits

Author SHA1 Message Date
Ed Page
2d7dc1ff8f chore: Release 2021-12-30 15:00:19 -06:00
Ed Page
ea02f6125d chore: Release 2021-12-30 14:28:32 -06:00
Ed Page
ff713d5ae5 chore: Release 2021-12-27 15:57:27 -06:00
Ed Page
8d94739de4 chore: Release 2021-12-23 14:28:46 -06:00
Ed Page
27893cfd9a chore: Release 2021-12-16 12:19:58 -06:00
Ed Page
c212402466 chore: Release 2021-12-16 09:33:06 -06:00
Ed Page
1100f04b56 chore: Release 2021-12-15 11:02:40 -06: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
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
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
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
e647b643cf docs(contrib): Generate-specific notes 2021-12-11 18:55:50 -06:00
Ed Page
c3f8c8938f chore: Release 2021-12-10 15:25:23 -06:00
Ed Page
ada95d6f3d chore: Release 2021-12-09 19:39:08 -06:00
Ed Page
4ab51976a3 chore: Release 2021-12-09 19:38:37 -06:00
Ed Page
3dec7df14f chore: Release 2021-12-09 07:00:33 -06:00
Ed Page
d444f46f92 chore: Release 2021-12-08 12:41:59 -06:00
Ed Page
093de2b83b docs: Add back in logo 2021-12-07 17:45:57 -06:00
Ed Page
98b899f978 docs: Expand child crate docs 2021-12-07 17:45:57 -06:00
Ed Page
ad797e70af docs: Remove reference to clap.rs 2021-12-06 20:56:47 -06:00
Ed Page
f517c0ede1 docs: Remove author fields 2021-12-06 11:24:23 -06:00
Ed Page
c23f9230d1 chore: Remove stale boiletplate 2021-12-06 11:04:41 -06:00
Ed Page
8595357542 chore: Only error for warnings in CI
This makes it easier for developers to iterate, not having to stop to
write docs just to get things building.
2021-12-06 11:03:14 -06:00
Ed Page
181eff5541 docs: Fix stale examples
These were broken in #17 and #38 when renaming `hidden` to `hide`.  These
weren't caught because we test with `--all-targets` which is mutually
exclusive with `--doc`.
2021-11-30 12:05:30 -06:00
Ed Page
2288f55cc1 test: Rely on release process for version sync
When we switch to `cargo-release`, it will validate that the auto-update
was performed.  No reason to have an extra dependency during
development.
2021-11-30 09:59:59 -06:00
Kurt Wolf
a9f4d759c0 Allow bash completions to work with an alias (clap-rs/clap#2054) 2021-11-29 09:02:52 -06:00
Ed Page
7e899cd340 Revert "Deprecate Arg::help in favour of Arg::about"
This reverts commits 24cb8b1..d0abb37 from clap-rs/clap#1840

This is part of #16.  clap-rs/clap#1840 wasn't the right call but we
don't have time to make the decision now, so instead of having one
option and changing it in 4.0, this reverts back to clap2 behavior.
2021-11-18 12:25:49 -06:00
dependabot[bot]
33240fcff3
chore(deps): Update pretty_assertions requirement from 0.7 to 1.0
Updates the requirements on [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) to permit the latest version.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.7.0...v1.0.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-17 21:34:15 +00:00
Ed Page
66341b3c11 fix: Always respect positional occurrences
When supporting multiple occurrences for positional arguments in #2804,
I added some tests to cover this but apparently simpler cases fail
despite those more complicated cases being tested.

This adds more multiple-occurrences tests for positional arguments,
fixes them, and in general equates multiple values with occurrences for
positional arguments as part of #2692.  There are a couple more points
for consideration for #2692 for us to decide on once this unblocks them
(usage special case in #2977 and how subcommand help should be handled).

I fully admit I have not fully quantified the impact of all of these
changes and am heavily relying on the quality of our tests to carry this
forward.
2021-11-01 14:14:04 -05:00
Ed Page
a065702205 docs(generate): Move derive example to generate
From a users perspective, `clap_derive` is baked into `clap`.
`clap_generate is an add on to `clap`.  So it seems best to have all
`clap_generate` examples in `clap_generate` where a user will look for
them.

Fixes #2939
2021-10-26 14:26:50 -05:00
Jake Shadle
db2a25473a Fix packaging of LICENSE-* files 2021-10-21 14:57:49 +02:00
Ed Page
9f12bfec47 fix!: Rename ArgValue to PossibleValue
In considering potential work for #2683, I realized we might need a type to carry data for
each of the `multiple_values`.  `ArgValue` works both for that and for
possible values, so we need to come up with a better name for one or
both.  Changing `ArgValue`s name now would be ideal since its new in
clap3 and by renaming it, we can reduce churn for users.

While thinking about this, I realized I regularly get these mixed
up, so renaming `ArgValue` to `PossibleValue` I think will help clear
things up, regardless of #2683.
2021-10-19 10:10:37 -05:00
rhysd
012f318c97 feat(doc): Fix many typos in docs, comments and codes found by typos-cli 2021-10-19 10:38:22 +09:00
Pavan Kumar Sunkara
585e995811 Release 3.0.0-beta.5 2021-10-17 17:01:18 +01:00
rhysd
33efcf1665 feat(generate): reduce dependencies of clap_generate (42 to 13) 2021-10-17 14:31:16 +09:00
Ajeet D'Souza
cad1879ab2 Improve bash generator 2021-10-14 22:51:40 +01:00
bors[bot]
11453065c5
Merge #2871 #2872 #2876
2871: Better positional checks r=epage a=pksunkara



2872: Iterate on help_heading to prepare for derive support r=pksunkara a=epage



2876: Generate/bash: add possible_values to completion when available r=pksunkara a=nstinus



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Co-authored-by: Ed Page <eopage@gmail.com>
Co-authored-by: Nicolas Stinus <nstinus@latourtrading.com>
2021-10-14 20:23:54 +00:00
Nicolas Stinus
bcf1bb69c8 fix(gen): address clippy suggestion
Change-Id: I11a8dc27956e6365a0c8ae8165e08d2209ae9395
2021-10-14 14:42:04 -04:00
Nicolas Stinus
de1c764905 fix(gen): in bash, pass use possible_values if available
Change-Id: I7a54821666f0ba366379d6cac83898fcd9b76ee6
2021-10-14 14:41:11 -04:00
Pavan Kumar Sunkara
f371cfed29 fix: Better positional checks 2021-10-14 09:26:53 +01:00
Pavan Kumar Sunkara
2454dabc03 refactor: Remove get_flags API 2021-10-14 09:26:09 +01:00
Ed Page
a61b60816c fix(gen): Ensure subcommands are post-processed
`App::get_matches` lazily post-processes `App`s and `Arg`s so we don't
do it to subcommands that are never run (downside being people have to
exercise their full app to get debug_asserts).

`clap_generate` was only post-processing the top-level `App` and `Arg`s,
ignoring the sub-commands.  In #2858, we noticed that `--version` was
being left in the completions instead of being removed during the
`_build` step.  We would also have an incorrect `num_vals` and a host of
other problems.

This change adds a `App::_build_all` function for `clap_generate` to use
to eagerly build everything.  By having it there, we make sure
everywhere that needs eager building, gets it (like some tests).

In `clap_generate::utils`, we add a unit test to ensure the subcommand's
`--version` was removed.

For some other tests specifying `.version()`, I added
`AppSettings::PropagateVersion` to make it behave more consistently.
The places I didn't were generally where the version was conditionally
set.

For `clap_generate/tests/generate_completions.rs`, I had to adjust the
`conflicts_with` because the subcommand was inheriting the argument with
it defined *but* the subcommand did not have the argument, tripping up a
debug assert.

Fixes #2860
2021-10-12 15:54:26 -05:00
Ed Page
536471cb7d fix(gen)!: Simplify Generator trait
This is a followup to #2721 where we decided to remove all of the
helpers from the trait.  They are now in a `utils` mod.  A part of me
wants this module to be private but it'd be a lot to duplicate for the
split out modules.

Note: this doesn't update fig.  Fig was never added to the workspace and
is already broken (and not just from #2721).  My plan is to get this
merged and then fix Fig, rather than fix it in multiple passes.
2021-10-12 08:27:24 -05:00
Paul Seyfert
25e337adb1 [clap_generate] [zsh] sort out multiple occurrence vs multiple_value. 2021-10-12 10:48:37 +01:00
Pavan Kumar Sunkara
0a61c8aa08 fix: Whitespace in our generators **is** important and we need to fix it 2021-10-12 02:08:11 +01:00
Pavan Kumar Sunkara
68d0338ddd chore: Minor doc and style changes 2021-10-12 02:08:11 +01:00
Ed Page
73bc22cc3d docs: Bridge the user to 'Shell'
In addition, this raises the visibility of the new `value_hint` feature.
2021-10-11 10:46:44 -05:00
Ed Page
96f2343e1b feat(generate): 'impl Generator for Shell'
This includes updating the example but does not include improving the
jumping-off documentation.
2021-10-11 10:46:44 -05:00
Ed Page
1bbfd956aa test: Harden tests against trailing whitespace
In a follow up commit, my editor stripped trailing whitespace.  Rather
than have everyone fight this, let's not make a deal over the small
stuff.
2021-10-11 10:44:48 -05:00
Ed Page
35d53d9dcf feat(generate): 'impl ArgEnum for Shell'
These keeps `FromStr` for ease of use with `value_of_t`.

This includes adding test to make sure everything works as expected.
2021-10-11 10:44:48 -05:00