src/cli/command.rs: improve error message

This commit is contained in:
Dietmar Maurer 2019-02-26 08:46:36 +01:00
parent 92a173feb0
commit f33fa27307

View File

@ -124,13 +124,17 @@ fn generate_usage_str(
let mut args = String::new(); let mut args = String::new();
for positional_arg in arg_param { for positional_arg in arg_param {
let (optional, _schema) = properties.get(positional_arg).unwrap(); match properties.get(positional_arg) {
args.push(' '); Some((optional, _schema)) => {
if *optional { args.push('['); } args.push(' ');
args.push('<'); args.push_str(positional_arg); args.push('>'); if *optional { args.push('['); }
if *optional { args.push(']'); } args.push('<'); args.push_str(positional_arg); args.push('>');
if *optional { args.push(']'); }
done_hash.insert(positional_arg); done_hash.insert(positional_arg);
}
None => panic!("no such property '{}' in schema", positional_arg),
}
} }
let mut arg_descr = String::new(); let mut arg_descr = String::new();