From 0fea85471de0039d634795d8c16e055644eb63b7 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 28 Oct 2024 02:10:37 +0100 Subject: [PATCH] Revert "fix: /bin/zsh env variable to retrieve current active shell" This reverts commit 5bffead6654c105d2cd35af5c5c5b1cea4593411. --- examples_test.go | 2 +- help.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples_test.go b/examples_test.go index 4e64009786..dfb49e177b 100644 --- a/examples_test.go +++ b/examples_test.go @@ -405,7 +405,7 @@ func ExampleCommand_Run_shellComplete_zsh() { // Simulate a zsh environment and command line arguments os.Args = []string{"greet", "--generate-shell-completion"} - os.Setenv("0", "/usr/bin/zsh") + os.Setenv("SHELL", "/usr/bin/zsh") _ = cmd.Run(context.Background(), os.Args) // Output: diff --git a/help.go b/help.go index 626968a8f7..10c2f6e8f0 100644 --- a/help.go +++ b/help.go @@ -164,7 +164,7 @@ func printCommandSuggestions(commands []*Command, writer io.Writer) { if command.Hidden { continue } - if strings.HasSuffix(os.Getenv("0"), "zsh") { + if strings.HasSuffix(os.Getenv("SHELL"), "zsh") { _, _ = fmt.Fprintf(writer, "%s:%s\n", command.Name, command.Usage) } else { _, _ = fmt.Fprintf(writer, "%s\n", command.Name)