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,14 +242,12 @@ pub fn get_help_completion(
}
let first = &args[0];
if first.starts_with("-") {
return get_simple_completion(help_cmd, &mut done, help_cmd.arg_param, &[], args);
}
if let Some(sub_cmd) = map.commands.get(first) {
if args.len() > 1 {
if let Some(sub_cmd) = map.commands.get(first) { // do exact match here
return get_help_completion(sub_cmd, help_cmd, &args[1..]);
}
return Vec::new();
}
let mut completions = Vec::new();
for cmd in map.commands.keys() {