From a9f4d759c040d1e99f0ff91591150e4f35dd0f0c Mon Sep 17 00:00:00 2001 From: Kurt Wolf Date: Sun, 28 Nov 2021 12:15:08 -0500 Subject: [PATCH] Allow bash completions to work with an alias (clap-rs/clap#2054) --- clap_generate/src/generators/shells/bash.rs | 2 +- clap_generate/tests/completions/bash.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clap_generate/src/generators/shells/bash.rs b/clap_generate/src/generators/shells/bash.rs index 426a44c0..cbf9baf1 100644 --- a/clap_generate/src/generators/shells/bash.rs +++ b/clap_generate/src/generators/shells/bash.rs @@ -33,7 +33,7 @@ impl Generator for Bash { for i in ${{COMP_WORDS[@]}} do case \"${{i}}\" in - {name}) + \"$1\") cmd=\"{cmd}\" ;;{subcmds} *) diff --git a/clap_generate/tests/completions/bash.rs b/clap_generate/tests/completions/bash.rs index 91cd8a44..6f715ba6 100644 --- a/clap_generate/tests/completions/bash.rs +++ b/clap_generate/tests/completions/bash.rs @@ -42,7 +42,7 @@ static BASH: &str = r#"_myapp() { for i in ${COMP_WORDS[@]} do case "${i}" in - myapp) + "$1") cmd="myapp" ;; help) @@ -139,7 +139,7 @@ static BASH_SPECIAL_CMDS: &str = r#"_my_app() { for i in ${COMP_WORDS[@]} do case "${i}" in - my_app) + "$1") cmd="my_app" ;; help) @@ -285,7 +285,7 @@ static BASH_ALIASES: &str = r#"_cmd() { for i in ${COMP_WORDS[@]} do case "${i}" in - cmd) + "$1") cmd="cmd" ;; *)