Commit graph

4095 commits

Author SHA1 Message Date
Richard Maw
f7e9bfed80 fixup! Add unstable-multicall flag to CI workflows 2021-10-15 20:27:29 +01:00
Richard Maw
694329b363 fixup! Make hostname a non-derive example and rename via Cargo.toml 2021-10-12 22:38:43 +01:00
Richard Maw
b808729bbc fixup! Fill in tracking issue number 2021-10-12 20:51:26 +01:00
Richard Maw
b2180e9d72 fixup! Gate Multicall behind unstable feature 2021-10-12 20:35:59 +01:00
Richard Maw
a31d3b288d fixup! Revert: Make hostname a non-derive example and rename via Cargo.toml
tests/examples.rs:examples_are_functional finds examples by stripping
`.rs` off the basename
2021-10-12 20:01:59 +01:00
Richard Maw
1782f9d4ec fixup! Make hostname a non-derive example and rename via Cargo.toml 2021-10-12 19:57:32 +01:00
Richard Maw
971b6b683e fixup! Move explanatory text from examples to docstring 2021-10-11 22:08:51 +01:00
Richard Maw
1ba4b98b8e fixup! trim hardlink implementation from busybox example 2021-10-11 20:51:33 +01:00
Richard Maw
d062f8f3ad fixup! Remove --install from tests/subcommands 2021-10-11 20:46:33 +01:00
Richard Maw
11492adb2c fixup! Fix rename of clap::Clap to Parser 2021-10-11 20:14:46 +01:00
Richard Maw
f14db03eec Add Multicall setting
If the AppSettings::Multicall setting is given
then argv0 is parsed as the first subcommand argument
or parsed as normal with any other name.
2021-10-11 20:00:24 +01:00
bors[bot]
562e64c723
Merge #2845
2845: fix(help)!: Consoldiate color settings r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-11 14:17:10 +00:00
Ed Page
6dd9d467ce fix(help)!: Consoldiate color settings
A lot of users expected `color` feature flag and `ColorAuto` etc to
control all colors.  Having this extra flag around is easy to miss and
adds to our overall settings bloat, making it harder to find settings
people want.

This completely removes it, rather than make it deprecated like
functions in #2617, because there is extra work to mark things
deprecated as Settings and we should decide on our strategy first before
investing time in addressing that issue.

Fixes #2806
2021-10-11 09:01:13 -05:00
bors[bot]
a63dcb35b5
Merge #2843
2843: add `App::get_long_about` r=pksunkara a=arxanas



Co-authored-by: Waleed Khan <me@waleedkhan.name>
2021-10-11 09:22:45 +00:00
Waleed Khan
e73ec0887d add App::get_long_about 2021-10-10 17:17:55 -07:00
bors[bot]
d97c038b1b
Merge #2814
2814: fix(derive)!: Rename `Clap` to `Parser`. r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-10 01:21:47 +00:00
Ed Page
d840d5650e fix(derive)!: Rename Clap to Parser.
Before #2005, `Clap` was a special trait that derived all clap traits it
detected were relevant (including an enum getting both `ArgEnum`,
`Clap`, and `Subcommand`).  Now, we have elevated `Clap`, `Args`,
`Subcommand`, and `ArgEnum` to be user facing but the name `Clap` isn't
very descriptive.

This also helps further clarify the relationships so a crate providing
an item to be `#[clap(flatten)]` or `#[clap(subcommand)]` is more likely
to choose the needed trait to derive.

Also, my proposed fix fo #2785 includes making `App` attributes almost
exclusively for `Clap`.  Clarifying the names/roles will help
communicate this.

For prior discussion, see #2583
2021-10-09 20:12:03 -05:00
bors[bot]
8552312fcb
Merge #2841
2841: chore: CI improvements r=epage a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-10-09 19:42:41 +00:00
Pavan Kumar Sunkara
49aaa5ab0b chore: CI improvements 2021-10-09 19:50:16 +01:00
bors[bot]
e8ec11e57f
Merge #2837
2837: fix: Gate App::replace r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-09 16:27:41 +00:00
Ed Page
dfbeb71077 fix: Gate App::replace
We are concerned about the level of polish of this feature and are
unsure enough about its future, we've decided to gate it to unblock the
v3 release.
2021-10-09 10:49:10 -05:00
bors[bot]
6919ee51cb
Merge #2831
2831: No empty version r=pksunkara a=kbknapp



Co-authored-by: Kevin K <kbknapp@gmail.com>
2021-10-09 15:21:43 +00:00
Kevin K
7b45695878
breaking(DisableVersionForSubcommands): removed
This commit removes `AppSettings::DisableVersionForSubcommand` as it's
now a moot setting with clap's default functionality of not building a
version flag unless there actually exists version information.

`clap_up` must still be changed to remove this variant instead of the
current configuration to simply rename the variant.
2021-10-09 11:12:50 -04:00
Kevin K
9fbe5841a7
chore: clippy lint fixes 2021-10-09 11:12:50 -04:00
Kevin K
0eba8015e3
chore: silence warning in example code 2021-10-09 11:12:50 -04:00
Kevin K
bb26ed1c8b
imp: adds debug_asserts against generating meaningless flags
This commit adds several debug asserts that ensure the user has not
accidentally generated a version flag that has no information. The
exception to this case is when the user wants to generate a version
flag, but then handle the version display manually. I.e. one can still
generate a "meaningless" version flag, but use
`AppSettings::NoAutoVersion` which is allowed.
2021-10-09 11:12:50 -04:00
Kevin K
07aae5ac54
docs(AppSettings): documents NoAutoHelp and NoAutoVersion
Since these tie in closely with the new default behavior of not
auto-generating the `-V/--version` flags when no information has been provided they are now documented.
2021-10-09 11:12:50 -04:00
Kevin K
14c8850019
tests: fixes test to new default behavior
This commit corrects tests to not expect the `-V,--version` flag when no
version information has been provided.
2021-10-09 11:12:50 -04:00
Kevin K
0addd938a6
tests(Examples): fixes examples for no-auto generated version 2021-10-09 11:06:48 -04:00
Kevin K
7169c47fed
imp(version flag): no longer generates a version unconditionally
This commit changes the default behavior of clap to no longer generate a
`-V, --version` flag when no version information has been provided.

Version information can be provided via `App::version`,
`App::long_version`, or via `App::mut_arg("version", |_| ..)`. Using any
of the above is the only way to have clap auto-generate the version flag.

Technically, clap still generates a version flag, however it is removed
prior to parsing if the user has not provided any version information
via one of the mentioned methods.

Relates to [#2812](https://github.com/clap-rs/clap/issues/2812)
2021-10-09 11:06:48 -04:00
bors[bot]
5afa640e3b
Merge #2834
2834: fix: Allow unicode-aware case insensitivity with ArgValue r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-09 12:37:33 +00:00
Ed Page
56a6a7418e fix: Allow unicode-aware case insensitivity with ArgValue
This also opens us up to being more unicode aware in other places, like
our sorting of arguments in the help.

Fixes #2792
2021-10-09 07:21:45 -05:00
Ed Page
2bbe9123ee fix!: Generalize unicode feature
This flag was added in v3.  This will allow us to put more related
functionality behind it.

BREAKING CHANGE: `unicode_help` was renamed to `unicode`.
2021-10-09 06:27:28 -05:00
Ed Page
8546f0e348
Merge pull request #2828 from grant0417/master
feat(generate): Add fig autocomplete generator
2021-10-09 05:10:22 -05:00
bors[bot]
dd16fcccc3
Merge #2830
2830: fix(ci): Restore serialization of site deployment r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-08 15:48:11 +00:00
Ed Page
598b87196a fix(ci): Restore serialization of site deployment
When removing `concurrency`, I overlooked this case where we want to
serialize deployments.

Queuing deployments also doesn't give us much.  I switched from using an
action for this to using built-in support.
2021-10-08 09:23:35 -05:00
grant0417
c3b8a96d65 Refactored fig generation code to crate 2021-10-07 20:54:14 -04:00
grant0417
8046f5074b Remove contib enum and expose contrib mod 2021-10-07 17:07:15 -04:00
bors[bot]
e3b23929b3
Merge #2823 #2824 #2827
2823: fix(derive): Subcommands not working within macro_rules r=epage a=epage



2824: docs(derive): Fix explanation on optional string list argument r=epage a=epage



2827: feat: Add backtraces to errors r=epage a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-07 18:49:59 +00:00
bors[bot]
6c2daef7a1
Merge #2821 #2822
2821: test(derive): Port structopt flatten coverage r=epage a=epage



2822: feat(derive): Add support for lower/upper in rename_all r=epage a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-10-07 16:02:20 +00:00
Ed Page
e42487f6e8 fix(derive): Subcommands not working within macro_rules
This carries over a test case from
https://github.com/TeXitoi/structopt/pull/448, and re-fixes it according
to the changes we've made since we forked.  I also tried to  identify
other cases and quote them to avoid playing whack-a-mole with this.

This is a part of #2809
2021-10-07 10:05:30 -05:00
Ed Page
7761cf00d7 docs(derive): Fix explanation on optional string list argument
This is a port of https://github.com/TeXitoi/structopt/pull/450

This is a part of #2809
2021-10-07 10:02:34 -05:00
Ed Page
7b5a4c9c2d feat: Add backtraces to errors
This is gated behind the `debug` feature flag so only explicit debugging
cases pay the build time and runtime costs.

The builder API's stack traces are generally not too interesting.  Where
this really helps is with `clap_derive`.  We currently panic on
unexpected conditions which at least gives us a backtrace.  We'd like to
turn these into errors but to do so would lose those debuggin
backtraces, which is where this comes in.

This is a part of #2255
2021-10-07 10:02:34 -05:00
Ed Page
f681e46414 test(derive): Port structopt flatten coverage
https://github.com/TeXitoi/structopt/pull/414 was ported in
a95195874 but the test was less exhaustive.  This updates our test to
match structopt's latest version of the test.

This is a part of #2809
2021-10-07 10:02:34 -05:00
Ed Page
e10b5281d6 feat(derive): Add support for lower/upper in rename_all
Some programs do not use anything to separate word boundaries.

For example a struct may contain the field `build_dir` while the flag is
`--builddir`.

This is a port of https://github.com/TeXitoi/structopt/pull/412

This is part of #2809
2021-10-07 10:02:34 -05:00
Ed Page
00f7fe5472
Merge pull request #2802 from epage/ci
Speed up PR feedback
2021-10-07 10:02:07 -05:00
Ed Page
8eb4377534
Merge pull request #2819 from epage/consistent
refactor(derive): Always do app_methods last
2021-10-07 09:04:42 -05:00
Ed Page
63275d3f13 Speed up PR feedback
This drops us down to just a handlful of jobs, allowing us full
parallelism (github caps max parallel jobs).  This is dependent on us
using bors to run the "ci" before merging into master.

There is a balance in what to run.  We should consider what is most
likely to break for the widest variety of PRs.  Contributors that expect
an uncovered case to fail can always specify `@bors try`

Motivation
- Mac is similar enough to Linux, we only need to run one of them and
  Linux has more parallel runners on Github.
- Since we deal with `OsStr`, test Windows because its different than
  the others.
- People are most likely to make changes on `stable` and break support
  for MSRV, so we should verify that
- Still test on `stable` to not block feedback if we run into problems
  with dependencies and our MSRV run.
- On the other hand, beta and nightly are less likely to break on an
  individual PR
- Remove benchmarks because most changes are not performance sensitive
  and we aren't looking at the results enough to justify a 30 minute run.

Fixes #2801
2021-10-07 09:02:28 -05:00
grant0417
b0edeb9be0 Move fig to contrib 2021-10-06 21:17:34 -04:00
Ed Page
74799ea916 Revert structopt #325
https://github.com/TeXitoi/structopt/pull/325 special cased `version`
because a default method would be added if the user did nothing, which
caused problems when nesting subcommands.  We no longer apply that
default method and the highest item in the chain always has precedence,
so this can be simplified / clarified.
2021-10-06 19:20:15 -05:00