Ed Page
d219c69c51
Merge pull request #4111 from epage/error
...
perf(error): Allow custmizing formatting
2022-08-24 12:57:38 -05:00
Ed Page
ef5f9f956a
perf(error): Allow custmizing formatting
...
For now, there isn't much a custom implementation can do.
Going from `Rich` to `Null` drops about 6 KiB from the binary
This is a part of #1365 and #1384
2022-08-24 12:40:21 -05:00
Ed Page
d16a531e54
feat(error): Expose context lookup
2022-08-24 11:12:13 -05:00
Ed Page
ba5a4bc6d4
refactor(error): Switch Vec to FlatMap
...
Looks like this dropped 2 KiB
2022-08-24 11:10:41 -05:00
Ed Page
956789c39f
Merge pull request #4110 from epage/styled
...
refactor(help): Prepare for user-visible styled string
2022-08-24 11:02:25 -05:00
Ed Page
3672663319
refactor(error): Delay colorizing until the end
...
This is prep for creating a formatter trait to select alternative
implementations for errors.
2022-08-24 11:00:20 -05:00
Ed Page
74f29fc52d
refactor: Remove inline(never) that don't change anything
2022-08-24 09:21:39 -05:00
Peter Grayson
a0b1a03877
docs: Apply review suggestions for #4106
2022-08-24 10:03:25 -04:00
Ed Page
79bdeb266a
Merge pull request #4082 from Calder-Ty/bugfix/3861
...
fix: Show possible values in generated man file
2022-08-24 08:31:29 -05:00
Tyler Calder
a55db43758
fix: Add possible vals to man for positional args
...
Noticed that possible values would not show up for Positional arguments
as well. Decided to add the changes for those as well.
2022-08-23 22:03:37 -06:00
Tyler Calder
069098cfcb
fix: Use roff bullet lists for possible_values
2022-08-23 21:54:46 -06:00
Tyler Calder
ec518e4819
fix: Take in account possible values being hidden
...
This makes sure we take into account the setting that possible args
is hidden
2022-08-23 21:47:17 -06:00
Tyler Calder
6342802f55
fix: Show possible values in generated man file
...
This adds feature parity for mangen with the standard help output. Users
will now see the list of possible values for value arguments.
One change that was made to make this possible was adding the method
`get_possible_values` to the public API for an arg. I tried to think of
a way to get around this, but because this is the interface that the
help generation uses, and it is part of the crate public interface
I thing adding it as a part of the public API might be for the best.
fixes : #3861
2022-08-23 21:47:17 -06:00
Ed Page
b0cac0845e
refactor(help): Pull out a StyledStr
...
This is prep for making it public
2022-08-23 17:05:55 -05:00
Ed Page
81d57a0cd4
refactor(help): Simplify writing
...
The performance gains of writing directly to the writer are not worth
the complexity. Output is not in our performance hot path.
Binary size went from 565.7 KiB to 562.2 KiB
2022-08-23 16:49:46 -05:00
Ed Page
d4ec9ca54f
Merge pull request #4107 from epage/help
...
fix: Don't pollute root with str types
2022-08-23 13:24:45 -05:00
Ed Page
276c75cc08
fix: Don't pollute root with str types
2022-08-23 13:12:06 -05:00
Peter Grayson
bcd1062fdf
docs: How to override multi-line usage
...
Extend Command::override_usage() doc string to describe how to format
multiple usage lines to be compatible with clap's default help formatter.
Relates-to: #3413
2022-08-23 11:21:07 -04:00
Ed Page
c6b8a7bafc
docs: Update changelog
2022-08-22 19:47:05 -05:00
Ed Page
a8523a0d0b
Merge pull request #4103 from epage/arg
...
fix: Switch to owned types
2022-08-22 16:48:15 -05:00
Ed Page
907941a565
style: Make clippy happy
2022-08-22 16:07:56 -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
71752f56ea
perf: Switch Str to use Box<Str>
...
Impact:
- Binary size: 556.6 KiB to 578.4 KiB 565.3 KiB
- build time: 9.6393 us
- parse time: 12.616 us
- parse sc time: 12.745 us
2022-08-22 14:56:16 -05:00
Ed Page
931d0e1bff
perf: Switch Str to use String
...
Impact
- Binary size: 556.6 KiB to 578.4 KiB to 574.6 KiB
- build time: 9.4581 us
- parse time: 13.055 us
- parse sc time: 13.384 us
2022-08-22 14:56:16 -05:00
Ed Page
9b9e57628d
refactor: Make Id consts more universal
2022-08-22 14:56:16 -05:00
Ed Page
049d6794b5
refactor: Isolate str inner
2022-08-22 14:56:16 -05:00
Ed Page
1bbf07e574
fix: Prefer more usable &str
for reflection
...
The downside is we can't skip allocations with
- `ValueEnum` default values
- Vaid subcommands
Otherwise, this is a big ergonomic win.
2022-08-22 14:56:16 -05:00
Ed Page
85f541d789
fix: Switch to owned types
...
Impact:
- Binary size: 556.6 KiB to 578.4 KiB
- build time: 6.4950 us (7% slower)
- parse time: 7.7256 us
- parse sc time: 8.1580 us (5% faster)
Fixes #1041
Fixes #2150
2022-08-22 14:55:55 -05:00
Ed Page
fefeb7ee6f
Merge pull request #4102 from grant0417/master
...
feat(clap_complete_fig): Escape all strings
2022-08-22 08:54:05 -05:00
grant0417
fedda32167
feat(fig): escape all strings
2022-08-21 00:46:32 -07:00
Ed Page
c023db3a98
Merge pull request #4099 from epage/sym
...
fix: Ensure partial eq is symetric
2022-08-19 16:52:29 -05:00
Ed Page
6de312f50a
fix: Ensure partial eq is symetric
2022-08-19 16:44:48 -05:00
Ed Page
d04ecd41f3
Merge pull request #4097 from epage/possible
...
fix!: Remove lifetime from PossibleValue
2022-08-19 13:50:48 -05:00
Ed Page
8cc164dafb
fix!: Remove lifetime from PossibleValue
...
Another step towards #1041
This isn't the long term type for `PossibleValue::help`, I just wanted
to get the lifetime out of the way first before figuring out how help
will work.
2022-08-19 12:44:29 -05:00
Ed Page
99d3bb8f74
Merge pull request #4096 from epage/raw
...
fix: Switch to owned OsStr type
2022-08-19 12:13:27 -05:00
Ed Page
e81b1aace7
Merge pull request #4095 from epage/flag
...
feat(parser): Make customizeing flags easier
2022-08-19 08:35:03 -05:00
Ed Page
9074b60194
feat(parser): Make customizeing flags easier
...
While `TypedValueParser` will generally make it easier to reuse value
parsers, this was particularly written for flags. Besides having a
concrete API to document, an advantage over `fn(&str) -> Result<bool, E>`
value parsers is you get all of the benefits of the existing value
parsers for environment variable parsing.
2022-08-19 08:21:55 -05:00
Ed Page
19d436d330
fix(parser): Move TypedValueParsers constraint earlier in process
2022-08-18 22:08:54 -05:00
Ed Page
cf7d78692b
Merge pull request #4092 from epage/flag
...
fix: Allow non-bool value_parsers for SetTrue
2022-08-18 21:52:31 -05:00
Ed Page
09354dec21
fix: Allow non-bool value_parsers for SetTrue
...
Not sure if we could have originally made this work but it definitely
does now that we use `default_missing_value` for this (#4000 )
2022-08-18 21:35:29 -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
91e55c6b9c
fix: Switch OsStr's in builder to owned/borrowed type
...
This is a part of #1041
Because `Option<Into<T>>` is ambiguous for `None`, we had to create
`Resettable` to workaround it.
2022-08-16 14:53:36 -05:00
Ed Page
554724f917
Merge pull request #4085 from orhun/docs/fix_typo_in_changelog
...
Fix typo in CHANGELOG.md
2022-08-16 13:47:51 -05:00
Orhun Parmaksız
97b0feffed
docs: Fix typo in changelog
2022-08-16 20:19:03 +02:00
Ed Page
5950c4b95f
Merge pull request #4084 from epage/predicate
...
fix!: Require/default conditional APIs are more explicit
2022-08-16 12:26:43 -05:00
Ed Page
09288b4bb9
fix!: Require/default conditional APIs are more explicit
...
This helps with
- API cleanup by not having ambigious `None`, see #950
- Removes ambiguity with `None` when using owned/borrowed types for
#1041
2022-08-16 11:52:10 -05:00
Ed Page
17a07abd9f
refactor: Remove lifetime from ArgPredicate
2022-08-16 10:58:58 -05:00
Ed Page
30d4ef4b09
fix: Allow OsStr for some required_if_eq calls
2022-08-16 10:22:24 -05:00
Ed Page
a42480198b
Merge pull request #4083 from LeSeulArtichaut/doc-typo
...
docs: fix typo in markdown formatting
2022-08-16 07:57:56 -05:00