You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument names are printed as values in the help message if no value_name of value_names was given for the CLI argument. The problem is located in src/args/help_writer.rs line 117. I tried to replace the line with: try!(write!(w, "<{}>", self.a.name())); but this breaks some other tests.
If no value_name was set the long or short argument name is printed twice before the arguments value.
externcrate clap;fnmain(){let addr = clap::Arg::with_name("address").long("address").short("a").takes_value(true).default_value("0.0.0.0").group("osc").help("Address to listen on for OSC messages.");let sr = clap::Arg::with_name("sample-rate").long("sample-rate").short("s").takes_value(true).default_value("48000").possible_values(&["44100","48000","88200","96000"]).help("Playback sample-rate");let ports = clap::Arg::with_name("ports").long("ports").short("p").required(true).takes_value(true).number_of_values(2).value_names(&["in","out"]).group("osc").help("OSC listening and send port.");let args = clap::App::new("ytterbium").version("0.1.0").author("Andreas Linz <[email protected]>").arg(addr).arg(ports).arg(sr);letmut buf:Vec<u8> = Vec::with_capacity(128);letmut out = ::std::io::stdout();
args.write_help(&mut out);}
This prints the following help message:
ytterbium 0.1.0
Andreas Linz <[email protected]>
USAGE:
ytterbium [FLAGS] [OPTIONS] --ports <in><out>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-a, --address --address <address> Address to listen on for OSC messages. [default: 0.0.0.0]
-p, --ports <in><out> OSC listening and send port.
-s, --sample-rate --sample-rate <sample-rate> Playback sample-rate [default: 48000] [values: 44100, 48000, 88200, 96000]
If you look at the OPTIONS you can see that --address is printed twice as well as --sample-rate.
Adding value_names fixes the problem:
let addr = clap::Arg::with_name("address")// ....takes_value(true).value_name("ip-address")// ...let sr = clap::Arg::with_name("sample-rate")// ....takes_value(true).value_name("sample-rate")// ...
...
OPTIONS:
-a, --address <ip-address> Address to listen on for OSC messages. [default: 0.0.0.0]
-p, --ports <in><out> OSC listening and send port.
-s, --sample-rate <sample-rate> Playback sample-rate [default: 48000] [values: 44100, 48000, 88200, 96000]
If this is intended behavior then please add a note in the documentation that setting value_names is mandatory for arguments that takes_value.
The text was updated successfully, but these errors were encountered:
Argument names are printed as values in the help message if no
value_name
ofvalue_names
was given for the CLI argument. The problem is located insrc/args/help_writer.rs
line 117. I tried to replace the line with:try!(write!(w, "<{}>", self.a.name()));
but this breaks some other tests.If no
value_name
was set thelong
orshort
argument name is printed twice before the arguments value.This prints the following help message:
If you look at the
OPTIONS
you can see that--address
is printed twice as well as--sample-rate
.Adding
value_name
s fixes the problem:If this is intended behavior then please add a note in the documentation that setting
value_name
s is mandatory for arguments thattakes_value
.The text was updated successfully, but these errors were encountered: