Skip to content

Commit

Permalink
fix(complete): Include positionals in subcommands
Browse files Browse the repository at this point in the history
Fixes #5139
  • Loading branch information
epage committed Sep 25, 2023
1 parent 82c93ce commit 017c258
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clap_complete/src/dynamic/completer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion clap_complete/tests/testsuite/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]"),
);
}
Expand Down

0 comments on commit 017c258

Please sign in to comment.