Replies: 1 comment
-
Another way of writing this is #[arg(
long,
num_args(0..=1),
action = clap::builder::ArgAction::Set,
default_value = "false",
default_missing_value = "true",
)]
flag: bool, At the time, there is not a better way. I would not want to provide a way of doing this without an explicit As an alternative, I think if we relax the #[arg(
long,
num_args(0..=1),
)]
flag: bool, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wish my boolean setting to be input either as:
--flag=true
or--flag
: meaningtrue
.--flag=false
: meaningfalse
.<default value>
(eithertrue
orfalse
).What I have come up with is:
It works the way I expect, but it looks very complicated. Is there a better way?
Or should I need to ask for some new magic like:
or something?
Beta Was this translation helpful? Give feedback.
All reactions