src/cli/command.rs: improve get_help_completion

This commit is contained in:
Dietmar Maurer 2019-12-01 10:18:47 +01:00
parent d69fcf3080
commit 309e449db2
1 changed files with 5 additions and 7 deletions

View File

@ -242,13 +242,11 @@ pub fn get_help_completion(
} }
let first = &args[0]; let first = &args[0];
if args.len() > 1 {
if first.starts_with("-") { if let Some(sub_cmd) = map.commands.get(first) { // do exact match here
return get_simple_completion(help_cmd, &mut done, help_cmd.arg_param, &[], args); return get_help_completion(sub_cmd, help_cmd, &args[1..]);
} }
return Vec::new();
if let Some(sub_cmd) = map.commands.get(first) {
return get_help_completion(sub_cmd, help_cmd, &args[1..]);
} }
let mut completions = Vec::new(); let mut completions = Vec::new();