Tuple arguments (e.g. --user login password) #4620
max-ishere
started this conversation in
Ideas
Replies: 1 comment
-
Our issue for this is #1717 The main problem is we only allow one One workaround is to have them be two separate flags that require each other #[arg(short, long, requires = "port")]
addr: String,
#[arg(short, long, requires = "addr")]
port: u16, The other is to parse the value after parsing clap. |
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 had 2 subcommands and for consistency I wanted to have an optional config file as an optional positional. However, in one of the commands I also had to specify additional information. Here is an example:
Ideally do2 would become
But they cannot. One solution would be:
But if you have port and address as optional, and you want the syntax in the example (
-a <ADDR> <PORT>
), you will need to make an optional subcommanda
. But that's confusing because inhelp
you don't seea
, you see<COMMAND>
:Beta Was this translation helpful? Give feedback.
All reactions