mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
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:
parent
9ee45f7f3d
commit
33fa7c4c19
2 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue