@@ -184,11 +184,12 @@ func DefaultRootCommandComplete(ctx context.Context, cmd *Command) {
184184var DefaultAppComplete = DefaultRootCommandComplete
185185
186186func printCommandSuggestions (commands []* Command , writer io.Writer ) {
187+ shell := os .Getenv ("SHELL" )
187188 for _ , command := range commands {
188189 if command .Hidden {
189190 continue
190191 }
191- if strings .HasSuffix (os . Getenv ( "SHELL" ) , "zsh" ) && len (command .Usage ) > 0 {
192+ if ( strings .HasSuffix (shell , "zsh" ) || strings . HasSuffix ( shell , "fish" ) ) && len (command .Usage ) > 0 {
192193 _ , _ = fmt .Fprintf (writer , "%s:%s\n " , command .Name , command .Usage )
193194 } else {
194195 _ , _ = fmt .Fprintf (writer , "%s\n " , command .Name )
@@ -240,7 +241,8 @@ func printFlagSuggestions(lastArg string, flags []Flag, writer io.Writer) {
240241 // match if last argument matches this flag and it is not repeated
241242 if strings .HasPrefix (name , cur ) && cur != name /* && !cliArgContains(name, os.Args)*/ {
242243 flagCompletion := fmt .Sprintf ("%s%s" , strings .Repeat ("-" , count ), name )
243- if usage != "" && strings .HasSuffix (os .Getenv ("SHELL" ), "zsh" ) {
244+ shell := os .Getenv ("SHELL" )
245+ if usage != "" && (strings .HasSuffix (shell , "zsh" ) || strings .HasSuffix (shell , "fish" )) {
244246 flagCompletion = fmt .Sprintf ("%s:%s" , flagCompletion , usage )
245247 }
246248 fmt .Fprintln (writer , flagCompletion )
0 commit comments