As part of my CLI tool, I have a clap::Arg
that takes multiple values, representing an (x, y)
coordinate. I want the use the be able to pass in the value as -p/--position 1 0
.arg(
clap::Arg::with_name("position")
.help("The position for yada yada yada")
.long("position")
.short("p")
.number_of_values(2)
.validator(|p| match p.parse::<usize>() {
Err(_) => Err(String::from("Error string")),
Ok(_) => Ok(()),
}
)
)
While this works for the interface I want, this creates a somewhat confusing help message:
... Help text ...
OPTIONS:
... other options ...
-p, --position <position> <position> The position for yada yada yada
What bothers me here is the -p, --position <position> <position>
, which seems to indicate that two positions are being passed to the argument. Is there any way I can replace the <position> <position>
with strings of my choice? (My goal is to get something like -p, --position <x> <y>
in the help message.)