cleanup parameter types

This commit is contained in:
Dietmar Maurer 2018-12-12 10:37:03 +01:00
parent 38555b5072
commit ca9caffa23
1 changed files with 4 additions and 4 deletions

View File

@ -116,7 +116,7 @@ fn record_done_arguments(done: &mut HashSet<String>, parameters: &ObjectSchema,
fn print_simple_completion( fn print_simple_completion(
cli_cmd: &CliCommand, cli_cmd: &CliCommand,
mut done: &mut HashSet<String>, done: &mut HashSet<String>,
arg_param: &[&str], arg_param: &[&str],
mut args: Vec<String>, mut args: Vec<String>,
) { ) {
@ -142,7 +142,7 @@ fn print_simple_completion(
} }
if args.is_empty() { return; } if args.is_empty() { return; }
record_done_arguments(&mut done, &cli_cmd.info.parameters, &args); record_done_arguments(done, &cli_cmd.info.parameters, &args);
let prefix = args.pop().unwrap(); // match on last arg let prefix = args.pop().unwrap(); // match on last arg
@ -150,8 +150,8 @@ fn print_simple_completion(
if !prefix.starts_with("-") && args.len() > 0 { if !prefix.starts_with("-") && args.len() > 0 {
let last = &args[args.len()-1]; let last = &args[args.len()-1];
if last.starts_with("--") && last.len() > 2 { if last.starts_with("--") && last.len() > 2 {
let prop_name = last[2..].to_owned(); let prop_name = &last[2..];
if let Some((_, schema)) = cli_cmd.info.parameters.properties.get::<str>(&prop_name) { if let Some((_, schema)) = cli_cmd.info.parameters.properties.get(prop_name) {
print_property_completion(schema, &prefix); print_property_completion(schema, &prefix);
} }
return; return;