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)