Commit graph

22 commits

Author SHA1 Message Date
Ed Page
bfa365a2cc feat(help): 'usage' feature flag for auto-genned usage 2022-09-19 13:15:47 -05:00
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
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
ff53b087e0 chore: Remove dead code 2022-05-02 05:52:18 -05:00
Pavan Kumar Sunkara
24b86d18d0 test: Remove unnecessary feature usage in tests 2022-02-13 19:00:29 +00:00
Ed Page
1f465b57e3
Merge pull request #3104 from epage/unstable
test: Actually allow unstable examples to be tested
2021-12-08 21:21:12 -06:00
Ed Page
130a1dc0e2 test: Actually allow unstable examples to be tested 2021-12-08 21:06:51 -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
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
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
6ce9714e2b fix: Deprecate YAML API
Fixes #9
2021-11-22 16:17:46 -06:00
Ed Page
4479282b11 style: Address warnings 2021-11-17 14:23:32 -06:00
Richard Maw
b92f2c0339 fixup! formatting lint 2021-10-15 21:14:26 +01:00
Richard Maw
636ecaffa2 fixup! make new tests compile but not run without unstable-multicall 2021-10-15 20:59:33 +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
Ed Page
bd25b5f615 fix(yaml): Don't panic on multiple groups
Because we gradually build the `ArgGroup` as we parse the YAML, we don't
use `ArgGroup::new`.  Clap3 introduced an internal `id` in addition to
the public `name` and it appears that this custom initialization code
was not updated.

This shows the problem with publically exposing `impl Default`.
Choices:
- Remove `impl Default`
  - Always valid
  - Requires spreading invariants
  - Callers can't implement code the same way we do
- Add `ArgGroup::name`
  - Can be constructed in an invalid state
  - Centralizes invariants
  - A caller could implement code like the yaml logic

I decided to go with `ArgGroup::name`.

Fixes #2719
2021-08-18 15:16:44 -05:00
Pavan Kumar Sunkara
49954c28ad Remove unstable feature flag 2021-03-13 11:40:56 +05:30
Matt Kantor
44ee8284c5 Exclude tests/examples.rs while checking coverage. 2020-08-24 10:23:49 -07:00
Matt Kantor
882f553c6a Test that --help works for all examples. 2020-08-23 11:23:43 -07:00