fix(complete): Include positionals in subcommands

Fixes #5139
This commit is contained in:
Ed Page 2023-09-25 16:15:02 -05:00
parent 82c93ce024
commit 017c258be1
2 changed files with 5 additions and 2 deletions

View file

@ -63,7 +63,7 @@ pub fn complete(
if let Ok(value) = arg.to_value() {
if let Some(next_cmd) = current_cmd.find_subcommand(value) {
current_cmd = next_cmd;
pos_index = 0;
pos_index = 1;
continue;
}
}

View file

@ -113,7 +113,10 @@ fn suggest_subcommand_positional() {
snapbox::assert_eq(
"--help\tPrint help (see more with '--help')
-h\tPrint help (see more with '--help')",
-h\tPrint help (see more with '--help')
hello-world\tSay hello to the world
hello-moon
goodbye-world",
complete!(cmd, "hello-world [TAB]"),
);
}