Skip to content

Commit

Permalink
Merge pull request #1997 from urfave/bartekpacia/fix/zsh_completion_c…
Browse files Browse the repository at this point in the history
…md_descriptions

Revert "fix: /bin/zsh env variable to retrieve current active shell"
  • Loading branch information
dearchap authored Oct 28, 2024
2 parents 6524cf9 + 0fea854 commit 083c12d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion help.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 083c12d

Please sign in to comment.