fix(complete): Fix command alias and Bash

With the previous fixes for #4273 and #4280 in place, it's now easy to
add support for subcommand aliases, which this commit does. This
addresses #4265 for Bash.
This commit is contained in:
Martin von Zweigbergk 2022-09-28 21:10:45 -07:00
parent 9ee45f7f3d
commit 33fa7c4c19
2 changed files with 10 additions and 0 deletions

View file

@ -90,6 +90,13 @@ fn all_subcommands(cmd: &Command) -> String {
cmd.get_name().to_string(),
fn_name.clone(),
));
for alias in cmd.get_visible_aliases() {
subcmds.push((
parent_fn_name.to_string(),
alias.to_string(),
fn_name.clone(),
));
}
for subcmd in cmd.get_subcommands() {
add_command(&fn_name, subcmd, subcmds);
}

View file

@ -18,6 +18,9 @@ _my-app() {
my__app,some_cmd)
cmd="my__app__some_cmd"
;;
my__app,some_cmd_alias)
cmd="my__app__some_cmd"
;;
my__app,test)
cmd="my__app__test"
;;