-
As per the title. If I look at the help for
I'm trying to do something similar with clap 4.5.4. If I have .arg(
clap::Arg::new("delete")
.required(false)
.short('d')
.long("delete")
.short_alias('D')
.action(clap::ArgAction::SetTrue),
)
.arg(
clap::Arg::new("force")
.required(false)
.short('f')
.long("force")
.short_alias('D')
.action(clap::ArgAction::SetTrue),
) it fails with What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
We had #2836 which was trying to support this, both here and for subcommands but that ran into problems and we stopped that effort. Allowing a short flag appear twice is an intriguing idea. My biggest concern is dealing with incompatible definitions of the two arguments and the help output (you wouldn't get that This can always be implemented manually with a helper unifying |
Beta Was this translation helpful? Give feedback.
We had #2836 which was trying to support this, both here and for subcommands but that ran into problems and we stopped that effort.
Allowing a short flag appear twice is an intriguing idea. My biggest concern is dealing with incompatible definitions of the two arguments and the help output (you wouldn't get that
-D
entry like git)This can always be implemented manually with a helper unifying
-D
with-d
and-f
. You can also declare them as conflicting if need be. I believe this gets all of the user-visible effects you want with a little bit of user logic on your side.