Make last
take precedence over allow_hyphen_values
#5039
Labels
A-parsing
Area: Parser's logic and needs it changed somehow.
C-enhancement
Category: Raise on the bar on expectations
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Clap Version
4.3.19
Describe your use case
former discussion: #4960
My program needs 2 kinds of command line arguments.
One is the options for the program itself (called
opts
), and the other is the command and its arguments passed to an external program (calledcmdline
).I'd like to distinguish between
opts
andcmdline
by separating them with a double hyphen--
. However, it does not work becauseallow_hyphen_values
has higher precedence thanlast
.Here is an example:
Run it in Bash like following.
As you can see,
last = true
is not in effect in the first 2 calls.Describe the solution you'd like
last
should take precedence overallow_hyphen_values
.Alternatives, if applicable
value_terminator = "--"
would be an alternative.However, it is ambiguous when the arguments does not contain the terminator
--
.On the other hand,
last
requires the double hyphen--
in the arguments.This is why I prefer
last
tovalue_terminator
.last
is less confusing.See comparison below:
(EDIT: Additional notes)
The difference between
last
andvalue_terminator = "--"
will be smaller after various bug fixes.In the examples I've given so far, the difference will be limited to the following cases:
Additional Context
(EDIT: Deleted, since it was poorly explained and hard to understand.)
The text was updated successfully, but these errors were encountered: