Multi valued flags break collapsing short flags #5361
Labels
A-parsing
Area: Parser's logic and needs it changed somehow.
C-bug
Category: Updating dependencies
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Rust Version
rustc 1.76.0 (07dca489a 2024-02-04)
Clap Version
4.5.1
Minimal reproducible code
Steps to reproduce the bug with the above code
The above code demonstrates several test cases. Among them is the problematic case
-ez foo bar
, wherez
is supposed to be interpreted as the noarg flag--zero-terminated
. Note that behavior like this is sometimes desirable, e.g. when emulating GNU shuf:Actual Behaviour
Clap interprets the
z
in-ez foo bar
as the sole argument to-e
, as if there was a call tovalue_delimiter
. clap then errors, and refuses to understand thefoo bar
part of the command.Expected Behaviour
Clap should (provide a switch to enable a mode in order to) prefer short-arg expansion over argument-taking. In other words, I want
-ez foo bar
to be interpreted as the two separate concepts--echo foo bar
and--zero-terminated
.Additional Context
I understand that this might be considered a breaking change. I can see at least two ways to go about this:
Command
-level, i.e.Command::single_dash_is_always_train_of_short_args(true)
or something like that, so that all agglomerations of short flags are switched here.Arg
-level, i.e.Arg::permit_direct_short_arg(false)
or something like that, so that-eARG
is not even considered.I admit that this may not be a "bug" in the "crash" sense, but it's definitely an incompatibility of existing features.
Debug Output
No response
Similar but different issues:
The text was updated successfully, but these errors were encountered: