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.
Describe the solution you'd like
last
should take precedence overallow_hyphen_values
.Alternatives, if applicable
value_terminator = "--"
would be an alternative, but it is ambiguous when the arguments does not contain the terminator--
. (see comparison below)On the other hand,
last
requires the terminator in the arguments.This is why I prefer
last = true
tovalue_terminator = "--"
;last
is less confusing.comparison of
value_terminator = "--"
andlast = true
The text was updated successfully, but these errors were encountered: