Skip to content

Commit 083c12d

Browse files
authored
Merge pull request #1997 from urfave/bartekpacia/fix/zsh_completion_cmd_descriptions
Revert "fix: /bin/zsh env variable to retrieve current active shell"
2 parents 6524cf9 + 0fea854 commit 083c12d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ func ExampleCommand_Run_shellComplete_zsh() {
405405

406406
// Simulate a zsh environment and command line arguments
407407
os.Args = []string{"greet", "--generate-shell-completion"}
408-
os.Setenv("0", "/usr/bin/zsh")
408+
os.Setenv("SHELL", "/usr/bin/zsh")
409409

410410
_ = cmd.Run(context.Background(), os.Args)
411411
// Output:

help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func printCommandSuggestions(commands []*Command, writer io.Writer) {
164164
if command.Hidden {
165165
continue
166166
}
167-
if strings.HasSuffix(os.Getenv("0"), "zsh") {
167+
if strings.HasSuffix(os.Getenv("SHELL"), "zsh") {
168168
_, _ = fmt.Fprintf(writer, "%s:%s\n", command.Name, command.Usage)
169169
} else {
170170
_, _ = fmt.Fprintf(writer, "%s\n", command.Name)

0 commit comments

Comments
 (0)