Commit graph

771 commits

Author SHA1 Message Date
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
2d83a7b12e feat(error): Break out error-context feature flag
This is a cheap pass at creating this to allow cutting out the cost of
rich error information / programmatic error information.

This cuts about 20 KiB off of the binary.

There is more we could cut out, like collecting of used arguments for
the usage, but I want to keep the conditionals simple.
2022-09-19 10:23:55 -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
Ed Page
fe43f0c945 Revert "fix: Remove once_cell dependency from derive"
This reverts commit 429143af42.
2022-09-16 16:19:03 -05:00
Ed Page
10854cd262 Revert "refactor: Remove once_cell dependency"
This reverts commit c9d883a8c6.
2022-09-16 16:14:32 -05:00
Ed Page
6bd4fee69f chore: Update dependencies 2022-09-01 07:09:32 -05:00
Ed Page
37f2efb0bd perf: Vendor textwrap parts we need
The immediate benefit is binary size but this also makes us more
flexible on the implementation, like allowing wrapping of `StyledStr`.

This removed 12 KiB from `.text`

This helps towards #1365 and probably #2037
2022-08-25 09:50:54 -05:00
Ed Page
735d6fd1e3 refactor: Extract our own display width
This added about 4 KiB to `.text` which makes sense since we duplicated
logic.
2022-08-24 18:19:03 -05:00
Ed Page
c9d883a8c6 refactor: Remove once_cell dependency 2022-08-22 16:07:14 -05:00
Ed Page
fc499ac0ec perf: Let users choose Str implementation
The binary size and performance difference is enough to make it
configurable.

Code size:
- default: 565.7 KiB
- perf: 578.5 KiB

Build time:
- default: 9.1706 us
- perf: 7.0479 us

Parse time:
- default: 12.673 us
- perf: 8.1708 us

Parse with subcommand time:
- default: 12.112 us
- perf: 7.9874 us
2022-08-22 15:47:21 -05:00
Ed Page
429143af42 fix: Remove once_cell dependency from derive
With being able to accept owned types now, `clap_derive` no longer needs
`once_cell` to make dynamic data static.

This helps towards #1365, #2037
2022-08-16 15:03:35 -05:00
Ed Page
9c9cc9fcff docs(cookbook): Add position-sensitive example 2022-08-15 10:59:05 -05:00
Ed Page
6e7fd6d4bc refactor: Move off of IndexMap/HashMap
This dropped 17KB

Again, performance shouldn't be too bad as the total number of argument
id's passed in by the user shouldn't be huge, with the upper end being
5-15 except for in extreme cases like rustc accepting arguments from
cargo via a file.
2022-08-11 14:06:41 -05:00
Ed Page
1c06735390 chore: Update dependencies 2022-08-10 21:49:22 -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
22c82c7404 docs(tutorial): Further expand on actions 2022-08-09 16:33:02 -05:00
Ed Page
36777e7b6c docs(tutorial): Switch to hand-implemented ValueEnum 2022-08-09 10:23:23 -05:00
dependabot[bot]
0bf1627e05
chore(deps): bump terminal_size from 0.1.17 to 0.2.1
Bumps [terminal_size](https://github.com/eminence/terminal-size) from 0.1.17 to 0.2.1.
- [Release notes](https://github.com/eminence/terminal-size/releases)
- [Commits](https://github.com/eminence/terminal-size/compare/v0.1.17...v0.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 07:04:43 +00: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
01a3ea425f fix!: Remove unstable-v4 feature gate 2022-07-22 11:34:06 -05:00
Ed Page
99d92c916c fix!: Remove yaml support 2022-07-21 12:46:47 -05:00
Ed Page
765af4198c fix!: Remove regex validation 2022-07-21 12:42:09 -05:00
Ed Page
d40e42a9ca chore: Release 2022-07-20 20:13:29 -05:00
Ed Page
e6b8b4b607 chore: Release 2022-07-19 14:41:47 -05:00
Ed Page
85ccf3e901 chore: Update release process 2022-07-19 14:41:42 -05:00
Ed Page
a8a7a61f56 chore: Release 2022-07-14 09:38:54 -05:00
Ed Page
2df0732df4 chore: Release 2022-07-13 09:08:35 -05:00
Ed Page
9b6321a1f0 chore: Release 2022-07-11 21:48:07 -05:00
Ed Page
074712a739 chore: Update release process 2022-07-11 21:47:35 -05:00
Ed Page
6614ffa6c8 chore: Release 2022-06-30 08:25:54 -05:00
Ed Page
b4a1362486 chore: Release 2022-06-28 08:04:18 -05:00
Ed Page
3c4e684c8b test: Verify auto-traits for core types
By checking these types, we'll get some other types for free, like
`Command` verifying `Arg`.

This was inspired by #3876
2022-06-27 20:50:29 -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
a7698e9a1d chore: Release 2022-06-15 11:50:16 -05:00
Ed Page
20358ff295 chore: Release 2022-06-14 15:01:42 -05:00
Ed Page
11fe3ce404 fix(derive): Allow opting in to the original deprecations 2022-06-14 14:26:34 -05:00
Ed Page
63a17a40ad chore: Release 2022-06-14 11:19:59 -05:00
Ed Page
7515bfeb51 fix: Allow people to opt-in to deprecations
This adds a new `Cargo.toml` feature named `deprecated` that opts
controls whether deprecation warnings show up.  This is starting off as
non-default though that may change (see below).

Benefits
- Allows a staged rollout so a smaller subset of users see new
  deprecations and can report their experience with them before everyone
  sees them.  For example, this reduces the number of people who have to
  deal with #3822.
- This allows people to defer responding to each new batch of
  deprecations and instead do it at once.  This means we should
  reconsider #3616.

The one risk is people who don't follow blog posts and guides having a
harder time upgrading to the next breaking release without the warnings
on by default.  For these users, we reserve the right to make the
`deprecated` feature `default`.  This is most likely to happen in a
minor release that is released in conjunction with the next major
release (e.g. when releasing 4.0.0, we release a 3.3.0 that enables
deprecations by default).  By using a feature, users can still disable
this if they want.

Thanks @joshtriplett for the idea
2022-06-14 10:50:05 -05:00
Ed Page
cb42df61e4 refactor: Switch to once_cell
Though this is changing an API item we export, we do not consider this a
breaking change because
- This was an implementation detail of the macros and people shouldn't be using it directly
- The `macro_rules` macro is coupled to `clap` because they are in the
  same crate
- The derive macro is coupled to `clap` because `clap` declares a
  `=x.y.z` dependency on `clap_derive

Fixes #3828
2022-06-14 09:10:50 -05:00
Ed Page
7836beda05 chore: Release 2022-06-14 07:02:40 -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
34368419c2 refactor(bench): Pull out benchmarks into own crate
This is mostly about avoiding criterion's build times when just
developing clap itself.

I'm assuming the derive test changed because criterion's clap v2 isn't
in the dependency tree anymore.
2022-06-03 13:51:26 -05:00
Ed Page
686b0379ce feat(multicall): Stablize multicall
`multicall` allows you to have one binary expose itself as multiple
programs, like busybox does.  This also works well for user clap for
parsing REPLs.

Fixes #2861
2022-05-20 12:20:40 -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
4a733cd879 fix: Bump MSRV to 1.56.0
This is needed for `Bound::cloned` and fits within official MSRV policy
(2 versions back) and unofficial (6 months, see #3267)
2022-05-17 17:13:08 -05:00
Ed Page
524e36cf1a chore: Release 2022-05-10 15:29:16 -05:00
Liu Dingming
1b63fbd6df feat(derive): Start unstable-v4 feature flag
This is split out of #3661 as several changes I'm working on need it.
2022-05-06 14:56:55 -05:00
Ed Page
55e791e80e chore: Release 2022-05-06 11:57:48 -05:00
Ed Page
17b930c203 chore: Release 2022-05-05 21:04:09 -05:00
Ed Page
0240ec5493 chore: Release 2022-05-02 13:02:10 -05:00
Ed Page
ec4735a44e docs: Add REPL example
This is to help in cases like #3668 and #3673
2022-05-02 06:27:57 -05:00
Ed Page
5e02ac1c19 chore: Release 2022-04-30 20:21:33 -05:00
Ed Page
b01256be36 chore: Release 2022-04-30 06:36:33 -05:00
Ed Page
0c5400dadb chore: Release 2022-04-30 06:35:57 -05:00
Ed Page
7cdce9cabe refactor(test): Use snapbox's diffs 2022-04-29 15:32:25 -05:00
Ed Page
d805c6031d chore: Release 2022-04-22 06:52:05 -05:00
Ed Page
a46ee83224 chore: Release 2022-04-21 20:08:49 -05:00
Ed Page
0194568b03 chore: Release 2022-04-19 10:31:52 -05:00
Ed Page
7598c000f9 chore: Release 2022-04-15 14:39:14 -05:00
Ed Page
ed57342bdd fix(derive): Couple derive version to clap
While `clap` depends on `clap_derive`, `clap_derive` inherently has a
dependency on `clap` because it generates code assuming at least a
specific clap version.  If a new `clap_derive` is used with an old
`clap`, it'll generate code that won't compile.

We've kept things loose because of
- Bad experiences with overly constrained version reqs
- To not force new `clap` versions to release `clap_derive`.
- People should have a lock file anyways

The downsides:
- `cargo install` does not use `Cargo.lock` by default, required
  `--locked`
- If we want people to not skip non-patch releases when upgrading, we
  need it to not be a pain
2022-04-15 14:09:28 -05:00
Ed Page
96dc6daa9e feat(lex): Pull out clap_lex 2022-04-15 10:55:37 -05:00
Ed Page
08f74046dc chore: Release 2022-04-01 09:15:32 -05:00
Ed Page
c75d2642ef chore: Release 2022-03-31 12:22:40 -05:00
Ed Page
4842f07045 docs(examples): Show duration parsing 2022-03-14 09:49:46 -05:00
Ed Page
a8ffebbab9 docs(examples): Generalize key-value example 2022-03-14 09:38:04 -05:00
Ed Page
9e3b661f08
Merge pull request #3544 from epage/trycmd
test: Switch completions/man to snapshot testing
2022-03-07 14:45:21 -06:00
Matt Fellenz
17193bd074
docs(derive): Builder/Derive interop reference (#3515)
Fixes #3500
2022-03-07 14:43:51 -06:00
Ed Page
aae158f3a2 chore: Upgrade trycmd 2022-03-07 13:27:24 -06:00
Ed Page
e702f42e5e chore: Release 2022-03-07 10:40:48 -06:00
Ed Page
20edbf08f7 docs(tutorial): Remove unneeded feature 2022-03-03 12:39:24 -06:00
Ed Page
e937955efb chore: Release 2022-03-02 09:49:11 -06:00
dependabot[bot]
e52ce536e0
chore(deps): update textwrap requirement from 0.14.0 to 0.15.0
Updates the requirements on [textwrap](https://github.com/mgeisler/textwrap) to permit the latest version.
- [Release notes](https://github.com/mgeisler/textwrap/releases)
- [Changelog](https://github.com/mgeisler/textwrap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mgeisler/textwrap/compare/0.14.0...0.15.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 15:21:59 +00:00
Ed Page
1e286f3dc2 chore: Release 2022-03-02 09:20:00 -06:00
Roland Fredenhagen
33949ce4de
feat(help): Show PossibleValue help in --help (#3503)
`-h` (short help) still shows the same.

This gates it behind an `unstable-v4` feature flag to avoid disrupting users who set the help without knowing where all it shows up (particularly derive users where `ArgEnum` is automatically extracting the help).

Fixes #3312
2022-03-02 09:15:28 -06:00
Ed Page
63fa59a251 chore: Release 2022-02-28 10:03:45 -06:00
Ed Page
20dc6673bc chore: Release 2022-02-23 09:39:40 -06:00
Ed Page
e8218733c2 docs(derive): Clarify subcommand arg syntax 2022-02-22 08:23:58 -06:00
Ed Page
655c3f0b9f chore: Release 2022-02-21 07:50:28 -06:00
Ed Page
e6729f96c3 chore: Release 2022-02-16 11:59:45 -06:00
Ed Page
62c2ca43c5 chore: Remove compatibility crates
Through the 3.x release, existng releases will continue to work, so no point in
keeping them around.
2022-02-16 11:25:34 -06:00
josh rotenberg
ee3eab1614 docs(tutorial): Demonstrate custom parsing
Adds a more in depth validator to validate that the port is in range in the derive and builder tutorial (section 4.2).

This supersedes #3416
2022-02-09 09:16:57 -06:00
Ed Page
86bf680645 fix(man): Rename crate to match style
I have access to the `clap-man` name but we use `clap_*`.  Rather than
people getting mixed up on which is supposed to use, we went with a
different name.
2022-02-07 20:20:01 -06:00
Ed Page
dc035de409 chore: Release 2022-02-01 16:11:53 -06:00
dependabot[bot]
55ac69827b
chore(deps): update trycmd requirement from 0.9 to 0.12
Updates the requirements on [trycmd](https://github.com/assert-rs/trycmd) to permit the latest version.
- [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/v0.9.0...v0.12.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-01 07:04:59 +00:00
Sondre Nilsen
0b045f5d0d
feat(man): Initial man generator (#3174)
This is an initial implementation with plenty of room to grow, including
- Allowing pulling out a subset of the generated man page for greater customization
- Subcommand handling
- Extra sections
- Consolidate argument formatter after #2914

Fixes #552
2022-01-28 14:55:55 -06:00
Ed Page
d2109b3969 chore: Release 2022-01-26 15:54:12 -06:00
Ed Page
7f1860e7e2 chore: Update release process 2022-01-26 15:54:06 -06:00
Ed Page
ea7699c11f chore: Release 2022-01-24 15:34:27 -06:00
Ed Page
e5b06c3061 chore: Release 2022-01-24 10:54:50 -06:00
Ed Page
afd0342a9b docs(readme): discuss API trade offs
Fixes #3329
2022-01-24 08:29:02 -06:00
Ed Page
3468325b8d docs: Describe the example we show
This also provides us another opportunity to link to the docs.
2022-01-18 19:38:53 -06:00
Ed Page
5877f884f1 chore: Release 2022-01-18 14:59:58 -06:00
Ed Page
bd1bf66279 chore: Release 2022-01-17 20:34:09 -06:00
Ed Page
ccbbba8908 chore: Release 2022-01-17 09:37:45 -06:00
Ed Page
3d8ce3f426 chore: Release 2022-01-12 11:12:42 -06:00
Ed Page
811fd6a04a chore: Release 2022-01-10 16:16:18 -06:00
Ed Page
c494da93ce chore: Share a tag between clap / clap_derive 2022-01-10 16:16:04 -06:00
Ed Page
ef823bbeaf chore: Release 2022-01-05 16:28:24 -06:00
Hugo Osvaldo Barrera
7110401595 docs: Fix messed up highlighting
This just affects how it's rendered; rather than attempting to highlight
these blocks as a shell script, they'll get highlighted as console
output.

See the rendered versions for a better comparison.
2022-01-05 11:53:06 -06:00
Ed Page
4ea1965789 chore: Release 2022-01-04 13:07:10 -06:00
Ed Page
9daefba196 chore: Release 2022-01-04 11:42:50 -06:00
Ed Page
d9906eb150 chore: Release 2022-01-04 09:49:41 -06:00
Ed Page
d392b88bd5 chore: Release 2022-01-03 12:12:28 -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
8d73a0e80f chore: Release 2021-12-31 12:23:47 -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
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
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
5643dddf3e docs(tutorial): Encourage App::debug_assert 2021-12-23 08:41:52 -06:00
Ed Page
65a18247bf docs: Update toml on pre-release 2021-12-17 10:58:01 -06:00
Xavier Bestel
8654c9035c docs: Automatically update version in README.md 2021-12-17 17:09:25 +01:00
Ed Page
27893cfd9a chore: Release 2021-12-16 12:19:58 -06:00
Ed Page
d14255dc00 docs: Show features in docs.rs
Confirmed this works with [`argfile`](https://docs.rs/argfile/latest/argfile/)

And then running in clap
```
$ RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
```
They now show up!
2021-12-16 10:38:31 -06:00
Ed Page
c212402466 chore: Release 2021-12-16 09:33:06 -06:00
ilslv
74d1c0898f
chore: Update version requirements (#3187)
Bump `termcolor` and `trybuild`
2021-12-16 09:18:54 -06:00
Ed Page
aa270f6aca docs(examples): Add cargo subcommand example 2021-12-15 12:07:29 -06:00
Ed Page
03cb509d6c refactor(examples): Change naming style
This is to make room for a reasonable looking cargo plugin example.

I got lazy and didn't update the tutorials.
2021-12-15 11:12:18 -06:00
Ed Page
1100f04b56 chore: Release 2021-12-15 11:02:40 -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
7731ca2d21 docs(derive): Show how to override special types
Fixes #3107
2021-12-09 09:32:33 -06:00
Ed Page
3dec7df14f chore: Release 2021-12-09 07:00:33 -06:00
Ed Page
d42cfee912 docs: Auto-tag feature flags
Fixes #3095
2021-12-08 20:37:53 -06:00
Ed Page
e98253dd4a fix: Rename 'doc' feature
This is prep for potentially other 'doc' changes
2021-12-08 20:10:47 -06:00
Ed Page
afac7b5d4e
Merge pull request #3098 from epage/examples
docs: Include examples on docs.rs
2021-12-08 20:09:57 -06:00
Ed Page
1191c3fb10 docs: Include examples on docs.rs
See https://twitter.com/wcrichton/status/1456112165744615426 or TWIR
415.

I'm mixed about the risk of using an unstable feature for our docs
though this seems like it'd be a big help.
2021-12-08 16:16:50 -06:00
Ed Page
92bb758e87 fix: Expose all features in playground
Looks like this is undocumented, see https://github.com/integer32llc/rust-playground/issues/192

Fixes #3065
2021-12-08 16:06:06 -06:00
Ed Page
d444f46f92 chore: Release 2021-12-08 12:41:59 -06:00
Ed Page
c807f892b1 chore: Configure release process
Experimenting with treating clap-derive and clap one and the same from
the release process perspective.  The completion generators are a bit
more independent.
2021-12-07 21:36:00 -06:00
Ed Page
c99adcc6c9 docs: Add key-value derive example
This is carried over from the clap_derive examples.  Looking over the
other examples, I feel like they are covered by other examples or by the
derive reference.  We should call out deny missing docs though.
2021-12-07 19:01:55 -06:00
Ed Page
ad797e70af docs: Remove reference to clap.rs 2021-12-06 20:56:47 -06:00
Ed Page
6b3ba22368
Merge pull request #97 from epage/rename
Prepare for rename
2021-12-06 12:06:51 -06:00
Ed Page
f517c0ede1 docs: Remove author fields 2021-12-06 11:24:23 -06:00
dependabot[bot]
b531964f46
chore(deps): update os_str_bytes requirement from 5.0 to 6.0
Updates the requirements on [os_str_bytes](https://github.com/dylni/os_str_bytes) to permit the latest version.
- [Release notes](https://github.com/dylni/os_str_bytes/releases)
- [Commits](https://github.com/dylni/os_str_bytes/compare/5.0.0...6.0.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 16:25:49 +00:00
Ed Page
befee6667b docs: Re-work examples
This creates distinct tutorial examples from complex feature examples
(more how-tos).  Both sets are getting builder / derive versions (at
least the critical ones).
2021-11-30 21:33:52 -06:00
Ed Page
b190a6a817 test: Consolidate clap tests
This reduces the need for us to have `clap` as a dependency in
`clap_derive`, preparing the way to fix #15.
2021-11-30 10:07:08 -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
Ed Page
f890bfa93b docs: Focus top-level README 2021-11-30 09:53:25 -06:00
Ed Page
e4c5d9d68d chore(ci): Verify unicode feature
In #27, we removed some default features.  When doing so, some places
weren't updated but `doc` feature covered it ... except it was only
partially updated.  This makes sure we test all the features.
2021-11-29 11:30:23 -06:00
Ed Page
6a56a98a12 docs: Include more features in rustdoc 2021-11-24 14:07:57 -06:00
Ed Page
c0f0713248 fix!: Lighten clap's default feature set
Too many times people have to disable default features.  Let's try to
have a more minimal out of box experience.

- `derive`: people are already used to adding this feature for serde
- `cargo`: not needed for derive
- `env`: most probably don't use this
- `unicode`: most CLIs are probably ASCII.  We should do a debug warn
  about this though

BREAKING CHANGE: `derive`, `cargo`, `env`, and `unicode` are no longer
on by default.
2021-11-24 10:35:29 -06:00
Ed Page
9c4194a5a1 test: Verify examples based on feature flags 2021-11-23 17:10:01 -06:00
Ed Page
bfa02fd418 test: More thoroughly test examples
This ports our example testing over to [trycmd](https://docs.rs/) so
we can:
- More thoroughly test our examples
- Provide always-up-to-date example usage

The old way of testing automatically picked up examples.  This new way
requires we have a `.md` file that uses the example in some way.

Notes:
- Moved overall example description to the `.md` file
- I added cross-linking between related examples
- `14_groups` had a redundant paragraph (twice talked about "one and
  only one"
2021-11-23 13:13:41 -06:00
Ed Page
ff476660ce test: Compile example in README 2021-11-17 21:01:56 -06:00
dependabot[bot]
7737ce6946
chore(deps): Update os_str_bytes requirement from 4.1 to 5.0
Updates the requirements on [os_str_bytes](https://github.com/dylni/os_str_bytes) to permit the latest version.
- [Release notes](https://github.com/dylni/os_str_bytes/releases)
- [Commits](https://github.com/dylni/os_str_bytes/compare/4.1.0...5.0.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-17 21:34:23 +00:00
Ed Page
4e546dd2a1 chore: Align on boilerplate 2021-11-17 15:24:50 -06:00
Ed Page
b06f69b08d chore(ci): Reduce scope 2021-11-17 15:01:16 -06:00
Ed Page
89e1c7206b chore: Remove dead code 2021-11-17 13:56:36 -06:00
Ed Page
bfa388420b Put grouped_values_of behind a feature gate
There is enough open work on this, we should probably not have it public
yet, so putting it behind a gate.  See https://github.com/clap-rs/clap/issues/2924
2021-10-26 14:26:50 -05:00
Jake Shadle
db2a25473a Fix packaging of LICENSE-* files 2021-10-21 14:57:49 +02:00
Pavan Kumar Sunkara
585e995811 Release 3.0.0-beta.5 2021-10-17 17:01:18 +01:00
bors[bot]
b835ce9061
Merge #2817
2817: Add support for Multicall executables as subcommands with a Multicall setting r=pksunkara a=fishface60



Co-authored-by: Richard Maw <richard.maw@gmail.com>
2021-10-16 00:32:52 +00: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
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
Ed Page
a61752a5d5 chore: Include fig in testing 2021-10-12 11:25:17 -05: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]
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
grant0417
c3b8a96d65 Refactored fig generation code to crate 2021-10-07 20:54:14 -04: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
b3847b76c4 refactor: Remove vec_map dependency
Doesn't look like this dependency is buying us anything at this point,
so removing it.
2021-09-17 15:14:49 -05:00
dylni
dc65513966 Replace ArgStr with os_str_bytes::RawOsStr 2021-08-29 10:00:30 -04:00
Donough Liu
b1d364a228
Pin clap_derive version (#2706)
* Pin clap_derive version

* Pin clap version in clap_generate
2021-08-17 08:43:37 +00:00
Pavan Kumar Sunkara
52be134949 Release 3.0.0-beta.4
clap@3.0.0-beta.4
clap_derive@3.0.0-beta.4
clap_generate@3.0.0-beta.4

Generated by cargo-workspaces
2021-08-14 23:40:49 +01:00
Pavan Kumar Sunkara
73b28fb104 Release 3.0.0-beta.3
clap@3.0.0-beta.3
clap_derive@3.0.0-beta.3
clap_generate@3.0.0-beta.3

Generated by cargo-workspaces
2021-08-14 23:01:13 +01:00
Pavan Kumar Sunkara
c7985fb73e Add env feature gate 2021-08-14 01:55:05 +01:00
Pavan Kumar Sunkara
6994be4f15 Remove doc feature 2021-07-30 22:49:11 +01:00
Rémi Lauzier
48147d680b
Update dependency that need no change 2021-06-17 13:58:40 -04:00
Pavan Kumar Sunkara
cedd110f10 Solve indexmap issue on WSL in ubuntu 2021-06-16 02:27:49 +01:00
Pavan Kumar Sunkara
94ce18c399 Update badges 2021-05-25 23:19:32 +01:00
Pavan Kumar Sunkara
49954c28ad Remove unstable feature flag 2021-03-13 11:40:56 +05:30
dylni
8a6881169b Upgrade os_str_bytes 2021-03-01 17:58:53 -05:00
Martin Geisler
df7a8c1282 feat: remove direct unicode-width dependency
This removes the direct dependency on unicode-width and delegates the
complexity of computing the displayed width of text to the Textwrap
crate.

The `display_width` function handles characters like “æøå” (Danish),
“äöü” (German), and “😂😍” (emojis) – even if the unicode-width
Cargo feature is disabled.

This is an improvement of the former `str_width` function which would
over-estimate the width of emojis and non-ASCII characters (since they
are several bytes wide).
2021-02-20 20:56:15 +01:00
ldm0
a684e9a51d Bump version-sync version 2021-02-14 09:51:23 +00:00
Donough Liu
c6da968ec7 Bump textwrap to 0.13.2 2021-01-02 13:15:50 +08:00
Pavan Kumar Sunkara
469aacda7e Move more to github ci 2020-11-06 21:02:06 +01:00
Pavan Kumar Sunkara
d881a1185b Release 3.0.0-beta.2
clap@3.0.0-beta.2
clap_derive@3.0.0-beta.2
clap_generate@3.0.0-beta.2

Generated by cargo-workspaces
2020-09-18 20:32:41 +02:00
bors[bot]
e4b5407296
Merge #1976 #2073
1976: Refactor r=pksunkara a=CreepySkeleton



2073: Add new "regex" feature r=CreepySkeleton a=bkaestner



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
Co-authored-by: Benjamin Kästner <benjamin.kaestner@gmail.com>
2020-08-28 17:14:31 +00:00
Pavan Kumar Sunkara
cfd1826052 Update changelog and upgrader 2020-08-28 17:27:47 +02:00
Benjamin Kästner
8cb9a7d486 Add new "regex" feature
This commit introduces a new feature called `"regex"`. It adds a new
function `validator_regex` to `Arg` and was inspired by the discussion
in #1968. The name `validator_regex` was chosen instead of
`regex_validator` to make sure that the developer keeps in mind that
there may only be a single `Validator` on an `Arg`.

The feature can be used with YAML files, however there is no proper
pattern in `clap_app!` (yet).
2020-08-26 17:54:54 +02:00
CreepySkeleton
fd1ee7872e Make caching in crate_authors! actually work 2020-08-21 08:21:21 +03:00
Pavan Kumar Sunkara
e68ec35a90 Move to terminal_size dep after the recent textwrap upgrade 2020-07-01 09:46:10 +02:00
Sebastian Dröge
1061354f17 Update to textwrap 0.12 2020-06-30 10:56:25 +03:00
Pavan Kumar Sunkara
b562ce4d63 Some modifications to allow cargo verification to work 2020-05-03 11:48:01 +02:00
dylni
99096ecbe9 Handle more edge cases for an ArgStr prefix 2020-05-01 18:19:40 -04:00
CreepySkeleton
20dab85143
Bump os_str_bytes in order to support wasi 2020-04-27 20:36:14 +03:00
Pavan Kumar Sunkara
910209fb05
Update Cargo.toml 2020-04-26 18:53:50 +02:00
Pavan Kumar Sunkara
74a7eed123 Update criterion away from fork 2020-04-26 16:12:04 +02:00
CreepySkeleton
739e7048a5 Make vec_map required dependency - in fact, it already is 2020-04-24 15:33:11 +03:00
dylni
c2246cf03f imp(src/util/osstringext.rs): Remove the last unsafe block 2020-04-23 09:02:10 -04:00
Pavan Kumar Sunkara
abc2ada63f Use github actions for windows 2020-04-21 00:16:32 +02:00
Pavan Kumar Sunkara
9d5de69249 Update Cargo.toml 2020-04-20 16:11:30 +02:00
Pavan Kumar Sunkara
070bd50b28 Finished color refactor 2020-04-16 12:51:26 +02:00
Pavan Kumar Sunkara
3bb8389c73 Enable ansi support for windows before refactoring 2020-04-12 10:20:08 +02:00
Pavan Kumar Sunkara
b45746feff Remove some defaults from profiles 2020-04-10 17:19:26 +02:00
Pavan Kumar Sunkara
2385ff8621 Coverage is now working 2020-04-10 15:26:41 +02:00
Pavan Kumar Sunkara
cceb29623a Remove nightly feature 2020-04-10 10:42:25 +02:00
CreepySkeleton
ee7ee9ba9f Select a single docs.rs build target 2020-03-20 03:02:39 +03:00
Pavan Kumar Sunkara
eaae1202cb Basic github action for benchmarking 2020-03-05 09:21:39 +01:00
CreepySkeleton
d466a56aa1 Fix benches 2020-03-04 21:31:18 +03:00
Pavan Kumar Sunkara
47782cfac6 Make cargo feature additive 2020-03-01 22:55:57 +01:00
CreepySkeleton
8ca1c22981 Good names for CI + cleanup 2020-02-21 18:21:32 +03:00
CreepySkeleton
9d1cf49ca8 Move to criterion 2020-02-21 18:21:31 +03:00
Pavan Kumar Sunkara
970d7140a3 Use 'Clap Maintainers' as authors 2020-02-10 20:16:25 +01:00
Pavan Kumar Sunkara
33f47acc67 Refactor clap_generate 2020-02-07 07:52:04 +01:00
bors[bot]
509ac33a20
Merge #1664
1664: Import structopt r=pksunkara a=CreepySkeleton

OK, here is about 50% of what's left to import.

`impl StructOpt for Box<impl StructOpt>` is not imported because layouts of `StructOpt` and `Clap` are too different. I'll work it out after the import is done.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/clap-rs/clap/1664)
<!-- Reviewable:end -->


Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: David McNeil <mcneil.david2@gmail.com>
2020-02-05 08:43:57 +00:00
Pavan Kumar Sunkara
49f096dab2 Use workspace.default-members 2020-02-04 09:41:05 +01:00
CreepySkeleton
cf11d46373 Default value for default_value (yeah, sounds awkward) 2020-02-04 11:40:01 +03:00
Pavan Kumar Sunkara
4d2c8ffa6b Update Cargo.toml files 2020-02-04 09:11:33 +01:00
Dylan DPC
a2ff3fa91b Revert " imp: Add exitcode::USAGE exit code as suggested in #1327" 2020-02-03 12:37:37 +01:00
Pavan Kumar Sunkara
6c338e42d0 Faster CI 2020-02-03 03:57:52 +01:00
Dylan DPC
6aaeb2718b
Update Cargo.toml 2020-02-02 01:28:19 +01:00
nazarov A. V
dc4d2faf76 Update yaml-rust to 0.4.3 2020-02-01 14:45:52 +03:00
CreepySkeleton
8be0a94951
Merge pull request #1638 from pksunkara/derive
Subtree merge clap_derive into this repo
2020-01-31 02:28:58 +03:00
Pavan Kumar Sunkara
7e0d820aa6 Run clap_derive tests in CI 2020-01-18 19:04:11 +05:30
Daniel Gray
a1445b0f3b imp: Add exitcode::USAGE exit code as suggested in #1327
The reason to do this is described well in issue #1327. It is also a
recommendation of the Rust book itself:
https://rust-cli.github.io/book/in-depth/exit-code.html
2020-01-17 11:20:45 -04:00
dylan_DPC
a2f9fb5f6c update bitflag to avoid cant find macro import on lower (1.0) versions 2019-11-30 02:06:52 +01:00
Dylan DPC
dd6c8e08ad use 2018 edition and minor refactors 2019-11-11 12:54:55 +01:00
Razican
4f97d51f1e
Upgraded ansi_term dependency 2019-10-31 09:05:47 +01:00
Bastien Orivel
ece3f66e0f Update strsim to 0.9 2019-08-25 13:03:03 +02:00
Erick Tryzelaar
2664703587 Fix most warnings
This patch:

* Removes unused `App::contains_long`
* Removes `std::ascii::AsciiExt` (deprecated in 1.26)
* Replaces `trim_left_matches` with `trim_start_matches` (added in 1.30)
* Adds `dyn` (added in 1.27)
* Removes unused `mkeymap::KeyType::{is_short,is_long}`
* Cleans up unused imports
2019-06-19 15:47:50 -07:00
Kevin K
0568dbd741
Merge pull request #1442 from arjunkathuria/v3-master
chore: bump the version for textwrap crate from 0.10 to 0.11
2019-04-05 21:15:32 -04:00
Kevin K
573b0a9e88
chore: upgrades to 2018 edition of Rust 2019-04-05 20:21:30 -04:00
Kevin K
3dffd4908c
Removing the lint features and invoking cargo clippy manually instead 2019-04-04 13:27:08 -04:00
Kevin K
d2fbc41060
Cargo.toml: Fix typos in description 2019-04-04 13:22:29 -04:00
Arjun Kathuria
fe2ef36112 chore: bump the version for textwrap crate from 0.10 to 0.11 2019-03-30 09:11:47 +05:30
Kevin K
9399174416
perf: trims down some macro usage 2018-11-14 21:04:15 -05:00
Kevin K
7accb93f46 chore: removes clippy dep in favor of cargo clippy 2018-11-14 16:06:20 -05:00
Kevin K
95f949efb0 chore: updates strsim dep 2018-11-14 16:06:07 -05:00
Kevin K
2a480451d3 refactor: clippy run 2018-11-14 14:01:48 -05:00
Kevin K
8dd7783cf3 chore: increase version 2018-10-20 21:55:03 -04:00
Kevin K
0f4096b3d4 imp: let users decide on codegen units and LTO 2018-10-19 23:36:22 -04:00
Kevin K
a769639f8b
chore: prepares for the move to clap-rs org 2018-08-01 23:06:12 -04:00
Kevin K
94e0d38c2d
chore: makes clap_derive a git dependency 2018-07-23 15:51:57 -04:00
Kevin K
ab8c97e3f1
chore: relicense under MIT and APACHE 2.0 2018-07-23 14:25:18 -04:00
Kevin K
53b2ca51f4
refactor(Derives): changes the derive traits for the clap_derive crate 2018-07-13 11:36:53 -04:00