Commit graph

5652 commits

Author SHA1 Message Date
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
Ed Page
54a153021b
Merge pull request #3765 from epage/refactor
fix(parser): Make behavior more consistent
2022-05-27 14:10:39 -05:00
Ed Page
e41a65d540 style: Fix typos 2022-05-27 13:56:38 -05:00
Ed Page
8f16f2ea41 refactor(parser): Clarify intent for defaults/envs
Especially important is not inferring intent from occurrences as
hopefully that will change with the introduction of actions.
2022-05-27 13:55:54 -05:00
Ed Page
2a409be7a5 refactor(parser): Clarify all ignored parse results 2022-05-27 13:15:34 -05:00
Ed Page
ac8320ddb2 refactor(parser): Make it more clear when we ignore parse results 2022-05-27 12:57:13 -05:00
Ed Page
9f4686714a fix(parser): Always end on required delimited arg
Before, if we were in trailing values that aren't delimite, we wouldn't
respect this flag and end processing of the value, now we do.

This also has a slight perf benefit of us only splitting the value if
the delimiter is present.  We checked for the delimiter anyways, so
doing it first removes a slight bit of work.

I also feel this helps clarify the intended behavior and ooches us
towards a unified code path for actions.
2022-05-27 10:31:10 -05:00
Ed Page
e268dbfbe9 refactor(parser): Clarify value consumption name 2022-05-27 09:23:21 -05:00
Ed Page
c72f03e53f refactor(parser): Be more explicit in default_missing_values
I wrote these tests expecting to highlight a bug but it turns out things
were structured just right to not exhibit it.  The fact that the code
looks like its broken is a problem, so I restructured it (put it first,
changed the source) so it doesn't look suspicious anymore.
2022-05-27 07:04:24 -05:00
Ed Page
92287c8181
Merge pull request #3764 from nyurik/patch-1
fix cargo.toml link
2022-05-27 06:49:11 -05:00
Yuri Astrakhan
3fd5e4bc33
fix cargo.toml link 2022-05-27 07:43:09 -04:00
Ed Page
302bf63678 fix(parser): Always use delimiter on defaults/env
Doesn't make sense to respect how the command line ended
2022-05-26 20:50:44 -05:00
Ed Page
ccc809a9df fix(parser): Allow delimiting default_missing_values
Fixes #3761
2022-05-26 20:36:49 -05:00
Ed Page
9805fdad1b refactor(parser)!: Consolidate group/occurrence logic
We were independently starting occurrences and starting value groups.
Now we do them at the same time.

COMPATIBILITY: This changes us from counting occurrences per positional
when using `multiple_values` to one occurrence.  This is user visible
and tests were written against it but it goes against the documentation
and doesn't quite make sense.
2022-05-26 19:30:29 -05:00
Ed Page
28cb71cddd fix(parser): Pass the intended flag to the action
Inferred flags can make it hard for a future action to trigger behavior
off of the selected alias, like we might want to do for negations, so we
are now translating to the intended arg.

This will also help for debugging.
2022-05-26 16:29:18 -05:00
Ed Page
03ed233ca7
Merge pull request #3759 from epage/deprecated
fix: Remove deprecation warning
2022-05-26 16:10:15 -05:00
Ed Page
868320097e refactor(parser): Consolidate help/version handling
This is a step towards user-visible actions
2022-05-26 15:55:48 -05:00
Ed Page
f082f499ea fix: Remove deprecation warning 2022-05-26 15:52:35 -05:00
Ed Page
f2f9aa1224
Merge pull request #3758 from epage/cleanup
refactor(parser): Remove dead code
2022-05-26 11:30:43 -05:00
Ed Page
e8e5890f08 refactor(parser): Remove dead code 2022-05-26 09:44:55 -05:00
Ed Page
d7879f107c
Merge pull request #3756 from epage/regex
fix(validator): Deprecate validator_regex
2022-05-25 14:46:10 -05:00
Ed Page
ae97550638 fix(validator): Deprecate validator_regex
Fixes #3743
2022-05-25 14:32:00 -05:00
Ed Page
52c1841d87
Merge pull request #3755 from epage/factory
feat(parser): Allow people to plug into 'value_parser' macro
2022-05-25 14:28:14 -05:00
Ed Page
fcdd31781b feat(parser): Allow people to plug into 'value_parser' macro
For most users, this won't be worth doing, they can just specify the
parser if needed.  Where this has value is crates that integrate custom
types into clap, like creating click-like file integration.  See
https://click.palletsprojects.com/en/8.0.x/arguments/#file-arguments
2022-05-25 14:12:27 -05:00
Ed Page
999647f6a0
Merge pull request #3753 from epage/deprecate
fix: Deprecate value_parser predecesor
2022-05-25 13:26:37 -05:00
Ed Page
408ca3c5d7 test(derive): Update for deprecations 2022-05-25 13:13:22 -05:00
Ed Page
814d30b1de fix(parser): Deprecate is_valid_arg 2022-05-25 13:00:51 -05:00
Ed Page
a712adefcd fix(parser): Deprecate value_of and friends 2022-05-25 12:57:11 -05:00
Ed Page
256643f8d3 fix: Deprecate possible_values 2022-05-25 12:57:11 -05:00
Ed Page
573d496bc6 fix: Deprecate forbid_empty_values 2022-05-25 12:57:11 -05:00
Ed Page
177511dab1 fix: Deprecate validator / validator_os
`validator_regex` is being ignored for now as I await on a comment
period for #3743
2022-05-25 12:57:11 -05:00
Ed Page
f15a1aab1a fix: Deprecate allow_invalid_utf8 2022-05-25 12:57:11 -05:00
Ed Page
5b6d68f247 fix(parser): Show cause of panic in backtrace 2022-05-25 12:57:11 -05:00