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,7 +124,8 @@ 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) {
Some((optional, _schema)) => {
args.push(' '); args.push(' ');
if *optional { args.push('['); } if *optional { args.push('['); }
args.push('<'); args.push_str(positional_arg); args.push('>'); args.push('<'); args.push_str(positional_arg); args.push('>');
@ -132,6 +133,9 @@ fn generate_usage_str(
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();
for positional_arg in arg_param { for positional_arg in arg_param {