Commit graph

3134 commits

Author SHA1 Message Date
Ed Page
32586c7b63 docs(tutorial): Split into separate modules per section
Unsure how much to read into this but some refer to the tutorial a a big
wall of ... and maybe breaking it down will help?
2023-09-12 09:24:27 -05:00
Ed Page
5f6d4a3dad docs(tutorial): Split out into a module 2023-09-11 21:02:11 -05:00
Ed Page
9e7404b599 docs(tutorial): Attempt to clarify attributes 2023-09-11 20:50:12 -05:00
Ed Page
db97a2c5be docs(derive): Clarify value attributes are for PossibleValue 2023-09-11 20:10:46 -05:00
Ed Page
087224a486 perf: Drop a dep for faster builds
`OnceLock` became available as of 1.70 which is older than our new MSRV.
We can easily get away without `Lazy` variants.
2023-08-31 12:54:45 -05:00
Ed Page
eb53db89f8 feat(help): Stabilize styling support
Fixes #3234
2023-08-28 09:49:48 -05:00
Ed Page
d30d94f51c chore: Update MSRV to 1.70 2023-08-24 10:14:23 -05:00
Ed Page
82f17a40c0 docs(builder): Provide styling examples 2023-07-17 17:10:33 -05:00
Ed Page
975eb0c686 docs(tutorial): Link out to other docs more
This is another step for trying to improve the understanding that the
derive and builder APIs are linked (#4090).

This also adds links to make it easier to discover more details on how
we infer behavior from a field's type.
2023-06-23 16:09:52 -05:00
Ed Page
7370c63caf docs(tutorial): Provide next steps
This is particularly to help call attention to builder methods as
attributes (#4090).
2023-06-23 15:43:48 -05:00
Ed Page
c2e6f1b790 docs(derive): Draw more attention to derive feature 2023-06-23 15:31:11 -05:00
Ed Page
ffbe6e9936 docs(derive): Ensure magic attributes are searchable 2023-06-23 13:20:21 -05:00
Ed Page
a9d50cfae9 docs: Link out to clio
Related to #4074
2023-06-23 12:53:01 -05:00
Ed Page
1db9df4a48 docs: Fix link to tutorial
Fixes #4964
2023-06-12 10:44:38 -05:00
Ed Page
777e4dc41b docs(derive): Clarify name is package name, not crate name
Fixes #4934
2023-05-23 08:38:02 -05:00
Ed Page
be885673ab docs(ref): Fix feature name 2023-05-02 10:05:00 -05:00
Ed Page
015f88b21a feat(help): Allow customizing terminal styling
For now, this is behind the `unstable-styles` feature as we verify this
is what we want for #3224
2023-04-18 15:22:42 -05:00
Ed Page
8f45d2f95a docs(derive): Reword opt-out 2023-03-28 08:34:29 -05:00
Ed Page
06d190751a docs(derive): Clarify opt-out of special type behavior
Inspired by #4808
2023-03-28 08:13:28 -05:00
Ed Page
56fe5e0ec0 fix!: Remove unstable-replace feature flag
This has been implemented for 3 years without much traction for
finishing it up.

The subcommand use case can be worked around by creating `Command`s that
just include the relevant logic, very similar to the default subcommand
examples in `git` / `git-derive`.

Using this for flags is covered by #4793.

Without `unstable-replace` being enabled, this still cut 5 KiB from
`cargo bloat --release --example git`.

Closes #2836
Closes #2011
2023-03-28 00:26:45 -05:00
Kurtis Nusbaum
5430df7a0f feat(derive): Support #[group] attributes
This adds the ability derive additional options for the group creation.

Fixes #4574
2023-03-25 03:25:38 -05:00
Ed Page
4e1a565b8a refactor: Split out clap_builder for faster derive builds
For now, we are still treating `clap` as the user facing API for both
builder and derive, making this an internal change as we don't expect
this to negatively impact builder build times all that much.  We can
re-evaluate at a later time and consider having distinct top-level
crates for builder and derive.

Looking at `--timings` on my machine
- `clap` only took 0.04s to build and it happened in
  parallel to `clap_builder` codegen
- this saved 1.7s for derive build times, with `clap_builder` building
  in parallel to `syn` and `clap_builder` and `clap_derive` finishing
  around the same time.

This was discussed some at https://rust-lang.zulipchat.com/#narrow/stream/220302-wg-cli/topic/clap.20build.20times.20and.20.60clap_derive.60.3A.20a.20crazy.20idea
2023-03-24 21:50:02 -05:00
Ed Page
5b65ede0ae style: Reduce unstable-v5 warnings 2023-03-24 21:32:58 -05:00
Ed Page
5d0fbb47ce doc: Clean up cfgs 2023-03-24 21:32:58 -05:00
Ed Page
f04ad2f38c
Merge pull request #4779 from epage/reserve
perf: Reduce alloc calls when building
2023-03-23 15:43:33 -05:00
Ed Page
a62fd05d53 perf: Reduce alloc calls when building
Inspired by #4774
2023-03-18 11:59:01 -05:00
Ed Page
769ccc5cd6 Revert "chore: Update bitflags dep to 2.0"
This reverts commit 6878a1911b.
2023-03-18 11:48:04 -05:00
Ed Page
cc1474f97c docs(help): Remove stale reference about wrapping
Fixes #4772
2023-03-17 00:16:13 -05:00
Nicholas Bishop
6878a1911b chore: Update bitflags dep to 2.0 2023-03-18 12:35:17 -04:00
Ed Page
fcd6a65e18 fix(help): Don't style newlines
Windows will style all blank space until the end of line (sometimes).

Fixes #4431
2023-03-16 18:59:54 -05:00
Ed Page
c0dc1cd008 fix(parser): Clarify get_count/get_flag assertion
Fixes #4763
2023-03-16 10:23:34 -05:00
Ed Page
6e1e754aa8 docs: Update docs for derived display order
Fixes #4728
2023-02-24 07:34:17 -06:00
Martin Fischer
8c92ef6c76
fix(help): Fix yet another --help long help edge case (#4712) 2023-02-15 11:33:35 -06:00
Martin Fischer
473cf175a2
fix(help): Fix --help help text in edge case (#4710)
We were accidentally showing long help just because a hidden argument had a description for a possible value.  This is most likely to be hit with the derive API as the value descriptions are automatically applied from documentation.
2023-02-15 10:25:19 -06:00
Aleksander Krauze
d6e7d4699f Improve builder::str::inner::Inner::into_string implementation
Since `Inner::into_string` already takes ownership of `self` we can
avoid unnecessary copy and allocation by moving `Box<str>` and using
its implementation of `Into<String>`.
2023-02-15 16:16:14 +01:00
Martin
704d0e7a4f chore: Make format!() calls more readable 2023-01-29 19:14:47 +00:00
Ed Page
6e5e31a02c docs(tutorial): Clarify use of Append in derive 2023-01-27 15:24:35 -06:00
Ed Page
7c4c6586d0
Merge pull request #4673 from epage/arg
perf: Speed up compiling `arg!` macro
2023-01-24 16:40:50 -06:00
Ed Page
bbe5eaa709 perf: Speed up compiling arg! macro
To "append" calls, we were passing in a more and more complex expression
on each recursive invocation.  We now pass in a fixed amount of data on
each iteration, reducing how much the macro machinery needs to parse,
speeding up builds.

Fresh builds went from 39s to 32s on my machine.

Inspired by #4670
2023-01-24 16:23:44 -06:00
Ed Page
dc89379ff6 fix(help): Respect disable_colored_help for arg_required_else_help
Fixes #4671
2023-01-24 15:53:00 -06:00
Ed Page
125dbe0cfd
Merge pull request #4667 from corneliusroemer/fix-4666
fix: Add plural s to context in suggestions
2023-01-23 15:58:37 -06:00
Cornelius Roemer
f5540d2646 fix(suggestions): Replace wrong Jaro-Winkler
Implementation of Jaro-Winkler similarity in the dguo/strsim-rs crate
is wrong, causing strings with common prefix >=10
to all be considered perfect matches

Using Jaro instead from the same crate fixes this issue
Benefit of favoring long prefixes exists for matching common names
But not for typo detection
Hence use of Jaro instead of Jaro-Winkler is acceptable

Confidence threshold adjusted so that `bar` is still suggested for `baz`
since Jaro is strictly < Jaro-Winkler
such an adjustment is expected. This is acceptable.
While exact suggestions may change, the net change will be positive
Suggestions are purely decorative and should thus not breaking change

Fixes #4660
Also see https://github.com/dguo/strsim-rs/issues/53
2023-01-23 22:43:48 +01:00
Cornelius Roemer
5dcc5c9509 fix: Add plural s in suggestions
Old: `note: subcommand 'test', 'temp' exist`
New: `note: subcommands 'test', 'temp' exist`
Fixes #4666
2023-01-23 22:16:50 +01:00
Ed Page
3591dc7e84 test: Remove extraneous to_owned's 2023-01-23 10:33:47 -06:00
Ed Page
cf970e6d0e test: Very best-fit for suggestions
Inspired by #4660
2023-01-23 09:58:03 -06:00
Ed Page
39fc252196 test: Re-enable suggestion tests 2023-01-23 09:55:14 -06:00
Ed Page
a493bb54f4
Merge pull request #4659 from epage/flag
docs: Prefer `get_flag` over `get_one::<bool>`
2023-01-23 09:36:21 -06:00
Ed Page
9d1de20787 docs: Prefer get_flag over get_one::<bool>
Inspired by #4654
2023-01-23 09:23:38 -06:00
Maria José Solano
bbf9b9c2f5
docs: Typo in tab tag 2023-01-14 13:05:17 -08:00
Ed Page
162a556dba fix(error): Try to soften unexpected argument/value errors
Adding "found" might seem minor but I feel it has a slight softening on the message.  It also maintains scanability as it is at the end and short.

As this is a one-off message change and not a styling issue to be consistent with, I think this is safe to put in a patch release.
2023-01-13 21:29:49 -06:00