Commit graph

6338 commits

Author SHA1 Message Date
Ed Page
f97670aca8
Merge pull request #4187 from epage/exp
fix(parser): Resolve problems around `allow_hyphen_values`
2022-09-07 07:39:23 -05:00
Ed Page
1258f3e5f6 fix: Deprecate Command::allow_negative_numbers
Better to set on individual args
2022-09-07 07:24:42 -05:00
Ed Page
8ad29ef337 feat: Allow specifying negative nums on Arg, like hyphens 2022-09-07 07:18:19 -05:00
Ed Page
16d5a2a19a perf: Shrink the code 2022-09-07 07:00:58 -05:00
Ed Page
2ebe5ae795 docs: Cross-link allow_hyphe_values with trailing_var_arg 2022-09-06 21:24:06 -05:00
Ed Page
d45e4be14b fix(derive): Deprecate Command::allow_hyphen_values
Fixes #3450
2022-09-06 20:50:09 -05:00
Ed Page
7a2bbca62b fix(derive): Make Command::allow_hyphen_values forward to Arg 2022-09-06 19:41:17 -05:00
Emerson Ford
fd9a5a1d50 fix(parser): Arg::allow_hyphen_values correctly handles long args in first pos
This makes it match up with `Command::allow_hyphen_values` which was the
guiding factor for what the behavior should be.

This supersedes #4039

Fixes #3880
Fixes #1538
2022-09-06 19:41:17 -05:00
Ed Page
94a5e7fa1a refactor(parser): Highlight short/long parallels 2022-09-06 19:41:17 -05:00
Ed Page
bc5c5e4a9f fix(parser): Make Command/Arg behave same for shorts with allow_hyphen_values 2022-09-06 19:41:17 -05:00
Ed Page
bffce7f57a fix: Deprecate Command::trailing_var_arg
Now that we have it on `Arg`, we don't need it on `Command`
2022-09-06 19:41:17 -05:00
Ed Page
b07d02ef46 feat: Allow specifying trailing_var_arg on Arg, like last
This has been a bit out of place being on the command.  Now its clearer
what the user intends to be the trailing var arg and it is more likely
to be discovered.
2022-09-06 19:41:14 -05:00
Ed Page
f731ce70e4
Merge pull request #4185 from epage/setting
refactor: Use parameters over settings
2022-09-06 15:09:53 -05:00
Ed Page
1dd9245fff refactor: Use parameters over settings 2022-09-06 14:43:02 -05:00
Ed Page
9a4c2bc990 docs: Improve description around trailing_var_arg 2022-09-06 14:34:47 -05:00
Ed Page
088b396d20
Merge pull request #4184 from epage/doc
refactor(derive): Clean up in prep for parent attributes
2022-09-06 13:22:36 -05:00
Ed Page
ede8fd6dbd style(derive): Clean up to make explicit methods easier 2022-09-06 12:54:50 -05:00
Ed Page
9c85839705 refactor(derive): Simplify processing of Subcommand 2022-09-06 12:54:50 -05:00
Ed Page
51dc3c63d6 refactor(derive): Treat subcommands like other Kinds 2022-09-06 12:54:50 -05:00
Ed Page
222003abe1 fix(derive): Disallow general attributes with from_global 2022-09-06 12:54:50 -05:00
Ed Page
a71b2eb8b8 refactor(derive): Shift responsibility for long help 2022-09-06 12:54:47 -05:00
Ed Page
abcee38466 fix(derive): Improve skip method error
Really this is about consolidating the skip checks but it also provideda
chance to improve the error.
2022-09-06 10:48:54 -05:00
Ed Page
8a5a9ba931 perf(derive): Only parse doc comments when needed for field/variant 2022-09-06 10:43:16 -05:00
Ed Page
9eb72ea5b6 fix(derive): Disallow attributes on top-level ValuEnum 2022-09-06 10:40:12 -05:00
Ed Page
1d973bd1c1 perf(derive): Don't parse ValueEnum's doc comment to ignore it 2022-09-06 10:36:22 -05:00
Ed Page
eece51fe04 refactor(derive): Give more control to the derive 2022-09-06 10:35:19 -05:00
Ed Page
71b9209a34 refactor(derive): Simplify Kind initialization 2022-09-06 07:56:08 -05:00
Ed Page
ade931be57 fix(derive): Be less prescriptive
With how flexible clap's API is, it can be hard to determine what is
reasonable to use with its API, so let's just stop.
2022-09-06 07:56:08 -05:00
Ed Page
b29f3ff22f refactor(derive): Delay error handling 2022-09-06 07:56:08 -05:00
Ed Page
f9e1ba2c1e fix(derive): Improve the default span 2022-09-06 07:56:07 -05:00
Ed Page
6648cf6009 refactor(derive): Remove unused Type for values
They have no type
2022-09-06 07:55:23 -05:00
Ed Page
f571821670 refactor(derive): Decouple attr and kind processing 2022-09-03 20:58:26 -05:00
Ed Page
9abcae2ac3 refactor(derive): Separate parsing from pushing of attrs 2022-09-03 20:56:33 -05:00
Ed Page
7ed7f71a1f
Merge pull request #4181 from epage/error
fix(derive): Report deprecations/errors in more cases
2022-09-03 12:40:11 -05:00
Ed Page
a7ed5d012d fix(derive): Deprecate using name for Args
The builder function was deprecated in v3 and removed in v4 but the
derive masked that, so we're still adapting things but now with a path
towards removal.
2022-09-02 19:57:37 -05:00
Ed Page
f9ad2c5f09 fix(derive): Guard against invalid attributes
We had some guards but this generalizes them and puts them on every
attribute.
2022-09-02 19:26:03 -05:00
Ed Page
f513862939
Merge pull request #4180 from epage/specialized
fix(derive): Replace clap attributes with command, arg, and value
2022-09-02 16:01:27 -05:00
Ed Page
47e3cb6498 docs: Update changelog 2022-09-02 15:44:41 -05:00
Ed Page
707f47f435 fix(derive): Deprecate 'clap' attribute 2022-09-02 15:39:24 -05:00
Ed Page
0e915e0d3a docs(derive): Update for new attributes 2022-09-02 15:39:13 -05:00
Ed Page
2609b970a4 refactor(test): Update UI tests to new attributes 2022-09-02 15:23:04 -05:00
Ed Page
20ba828f21
Merge pull request #4179 from epage/attr
refactor(derive): Prepare for builder attributes
2022-09-02 15:13:08 -05:00
Ed Page
e0f2f6fbae fix(derive): Builder-specialized attributes 2022-09-02 14:06:27 -05:00
Ed Page
dbdd449dc3 refactor(derive): Further generalize kind errors 2022-09-02 14:03:34 -05:00
Ed Page
97ce0c44f7 refactor(derive): Generalize Kind based error checks 2022-09-02 14:03:34 -05:00
Ed Page
59a4578898 refactor(derive): Track the item's Kind 2022-09-02 14:03:34 -05:00
Ed Page
0ae119fda9 fix(derive): Report deprecations for structopt attributes
This is more of a test bed for adding new attributes and deprecating
clap ones.
2022-09-02 14:03:31 -05:00
Ed Page
7b0c76de31 Revert "fix(derive): Remove structopt attribute support"
This reverts commit 521a012c28.
2022-09-02 11:15:15 -05:00
Ed Page
7eaa226526 fix(derive): Provide deprecations for bald action/value_parser
These will be going away, so we should tell the user.

This is mostly a test bed for our new deprecation plumbing.
2022-09-02 11:14:31 -05:00
Ed Page
edce5c2119 fix(derive): Improve Kind conflict errors
This makes it better scale for the future
2022-09-02 10:48:38 -05:00