From e3ff5738251ef4f65959f9f23321a1d9aa086de5 Mon Sep 17 00:00:00 2001 From: Ajitem Sahasrabuddhe Date: Wed, 21 Aug 2024 17:43:56 +0530 Subject: [PATCH] fix: /bin/zsh env variable to retrieve current active shell --- app_test.go | 2 +- help.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app_test.go b/app_test.go index 5151a48223..1c444ec926 100644 --- a/app_test.go +++ b/app_test.go @@ -369,7 +369,7 @@ func ExampleApp_Run_bashComplete() { func ExampleApp_Run_zshComplete() { // set args for examples sake os.Args = []string{"greet", "--generate-bash-completion"} - _ = os.Setenv("SHELL", "/usr/bin/zsh") + _ = os.Setenv("0", "/usr/bin/zsh") app := NewApp() app.Name = "greet" diff --git a/help.go b/help.go index 874be941c0..f1b9e7f18f 100644 --- a/help.go +++ b/help.go @@ -150,7 +150,7 @@ func printCommandSuggestions(commands []*Command, writer io.Writer) { if command.Hidden { continue } - if strings.HasSuffix(os.Getenv("SHELL"), "zsh") { + if strings.HasSuffix(os.Getenv("0"), "zsh") { for _, name := range command.Names() { _, _ = fmt.Fprintf(writer, "%s:%s\n", name, command.Usage) }