Ed Page
cc2714beab
fix(parser): Don't allow error equality
...
This could cause surprising results for users as we add fields
2022-06-02 13:36:05 -05:00
Ed Page
773ba94c4e
refactor(derive): Merge handling of bool/from_flag
...
This will make it easier to divide off parser logic for adding in
actions.
This does mean we can't provide error reporting on bad values with
`bool` but
- We should have also been doing that for `from_flag`
- We'll be dropping this soon in clap4 anyways
2022-06-02 13:01:59 -05:00
Ed Page
dfc55cd6e3
test(derive): Update ui test to be correct otherwise
2022-06-02 11:59:09 -05:00
Ed Page
e5ead4ce49
refactor(derive): Default parser based on type
2022-06-02 11:50:45 -05:00
Ed Page
f61aad4b34
refactor(derive): Resolve value parsers earlier
2022-06-02 11:14:25 -05:00
Ed Page
96ac83e260
refactor(derive): Simplify needs for finding the inner type
2022-06-02 11:07:43 -05:00
Ed Page
758f3fff18
Merge pull request #3779 from epage/docs
...
docs(builder): Note the type for 'Count'
2022-06-01 16:59:58 -05:00
Ed Page
ab08a3069a
docs(builder): Note the type for 'Count'
2022-06-01 16:23:19 -05:00
Ed Page
ec9d180e11
Merge pull request #3778 from epage/unify
...
fix(derive): Align value parser's type with occurrences_of
2022-06-01 12:16:19 -05:00
Ed Page
bbab148289
fix(derive): Align value parser's type with occurrences_of
2022-06-01 11:21:34 -05:00
Ed Page
b417e62ccd
Merge pull request #3777 from epage/set
...
feat(builder): Set/Append Actions
2022-06-01 11:09:05 -05:00
Ed Page
95c812b411
feat(builder): Set/Append Actions
...
This round out the new style actions and allow us to start deprecating
occurrences.
As part of an effort to unify code paths, this does change flag parsing
to do splits. This will only be a problem if the user enables splits
but we'll at least not crash. Once we also address #3776 , we'll be able
to have envs all work the same.
2022-06-01 10:12:44 -05:00
Ed Page
70767524c0
Merge pull request #3775 from epage/new
...
feat(parser): SetTrue/SetFalse/Count Actions
2022-06-01 07:07:27 -05:00
Ed Page
c58a802a1d
style: Make clippy happy
2022-06-01 06:45:23 -05:00
Ed Page
20ed49a535
Merge pull request #3774 from epage/action
...
feat(builder): Expose ArgAction
2022-05-31 21:25:19 -05:00
Ed Page
2e9e556359
test(parser): Ensure conditional requirements work with new Actions
2022-05-31 21:21:50 -05:00
Ed Page
4afd1aafe5
fix(parser): Don't double-increment index on flags
2022-05-31 21:21:50 -05:00
Ed Page
06ea572770
fix(parser): Apply conditional defaults
...
Now that we can store constants for flags, we can apply defaults for
flags too.
Fixes #3294
2022-05-31 21:21:50 -05:00
Ed Page
67f47c5618
feat(parser): SetTrue/SetFalse/Count Actions
...
This is the minimum set of actions for the derive to move off of
`parse`. These are inspired by Python's native actions.
These new actions have a "unified" behavior with defaults/envs. This
mostly means that occurrences aren't tracked. Occurrences were used as
a substitute for `ValueSource` or for counting values. Both cases
shouldn't be needed anymore but we can re-evaluate this later if needed.
2022-05-31 21:21:48 -05:00
Ed Page
36680593be
refactor(parser): Clarify intent of push_arg_values
2022-05-31 20:46:22 -05:00
Ed Page
7163f8d3e8
refactor(parser): Clarify intent of split_arg_values
2022-05-31 20:46:22 -05:00
Ed Page
e53dd937be
feat(builder): Infer takes_vaue from action
2022-05-31 20:46:22 -05:00
Ed Page
91480de6d2
feat(builder): Expose ArgAction
2022-05-31 20:46:22 -05:00
Ed Page
b1b5820cb4
refactor(asserts): Ensure we always check positionals take values
2022-05-31 20:46:22 -05:00
Ed Page
2b95985161
refactor(parser): Ensure action and are are in-sync
2022-05-31 20:45:56 -05:00
Ed Page
7264bf28c7
refactor(parser): Clarify Action::Flag's behavior
2022-05-31 15:11:24 -05:00
Ed Page
eeca653697
refactor(parser): Loosen Action trait requirements
2022-05-31 15:10:07 -05:00
Ed Page
fb99d2c625
refactor(parser): Allow adding more actions in the future
2022-05-31 15:09:30 -05:00
Ed Page
66567d16a4
Merge pull request #3773 from epage/pending
...
refactor(parser): Extract Actions from Parser
2022-05-31 15:07:47 -05:00
Ed Page
8af7294a26
style: Make clippy happy
2022-05-31 14:50:56 -05:00
Ed Page
12d145c60d
style: Fix debug typoe
2022-05-31 14:44:36 -05:00
Ed Page
70b633b0ea
refactor(parser): Be explicit about not not iterating over every value
2022-05-31 14:44:36 -05:00
Ed Page
5a55f4a863
fix(parser): Restore positional occurrence behavior
...
This fixes a compatibility issue introduced in 9805fdad1b
2022-05-31 14:44:36 -05:00
Ed Page
c052a976b8
fix(parser): Qualify the type of action
...
My hope is to add group actions as well, so we need to qualify what kind
of action this is.
2022-05-31 14:22:24 -05:00
Ed Page
cb6f7b783a
fix(parser): Restore interleaved positional behavior
...
If we felt this was important long-term, we should fix this outside of
the Action. Since we might be changing up occurrences (#3772 ), we can
probably get away with a hack.
2022-05-31 14:15:57 -05:00
Ed Page
f2a219e77d
refactor(parser)!: Switch flag values to Actions
...
This changes how occurrences and values are grouped for multiple values.
Today, it appears as a bug. If we move forward with #3772 , then this
can make sense.
2022-05-31 14:04:12 -05:00
Ed Page
bba83cb2af
test(parser): Verify interleaved group behavior
2022-05-31 14:00:48 -05:00
Ed Page
bf7259d644
refactor(parser): Switch positionals to actions
2022-05-31 10:35:54 -05:00
Ed Page
e43bd1fa7c
Merge pull request #3771 from epage/ref
...
docs(derive): Make raw attribute more discoverable
2022-05-30 19:25:47 -05:00
Ed Page
b39d3d4f2b
docs(derive): Make raw attribute more discoverable
...
Based on feedback in #3189
2022-05-30 18:41:10 -05:00
Ed Page
6f5aaab443
refactor(parser): Allow more match-state
2022-05-27 20:10:53 -05:00
Ed Page
0b5de2198e
refactor(parser): Don't track the actual identifier
...
When creating `PendingValues`, I can't have the lifetime. I could make
it a `Cow` but decided to hold off instead since we don't need this
right now. Maybe by the time we do need it, we'll have another way of
doing this.
2022-05-27 19:50:47 -05:00
Ed Page
2d8a15453e
refactor(parser): Be more explicit that default missing values is not escaped
2022-05-27 19:40:49 -05:00
Ed Page
dc8a7d420e
refactor(parser): Switch defaults/envs to actions
...
There is a default_missing_vals case which is slightly different because
its not actually a default but closing out the remaining argument that
was started in last iteration.
2022-05-27 19:34:19 -05:00
Ed Page
a98075e9cd
refactor(parser); Switch default_missing_vals to actions
2022-05-27 19:07:28 -05:00
Ed Page
f0b2924f36
refactor(parser): Match default_missing_vals to rest
2022-05-27 19:06:23 -05:00
Ed Page
e1c5cba5f9
refactor(parser): Extract an occurrence into a reaction
2022-05-27 16:50:28 -05:00
Ed Page
b862fe227a
refactor(parser): Generalize the performing of actions
2022-05-27 16:30:38 -05:00
Ed Page
7b6bb32985
refactor(parser): Separate delimiting from storing
2022-05-27 16:27:35 -05:00
Ed Page
e4271d09d9
refactor(parser): Normalize Arg variable names
2022-05-27 15:51:35 -05:00