Skip to content

Commit e3ff573

Browse files
fix: /bin/zsh env variable to retrieve current active shell
1 parent 9114559 commit e3ff573

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func ExampleApp_Run_bashComplete() {
369369
func ExampleApp_Run_zshComplete() {
370370
// set args for examples sake
371371
os.Args = []string{"greet", "--generate-bash-completion"}
372-
_ = os.Setenv("SHELL", "/usr/bin/zsh")
372+
_ = os.Setenv("0", "/usr/bin/zsh")
373373

374374
app := NewApp()
375375
app.Name = "greet"

help.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func printCommandSuggestions(commands []*Command, writer io.Writer) {
150150
if command.Hidden {
151151
continue
152152
}
153-
if strings.HasSuffix(os.Getenv("SHELL"), "zsh") {
153+
if strings.HasSuffix(os.Getenv("0"), "zsh") {
154154
for _, name := range command.Names() {
155155
_, _ = fmt.Fprintf(writer, "%s:%s\n", name, command.Usage)
156156
}

0 commit comments

Comments
 (0)