@@ -27,19 +27,21 @@ import (
27
27
28
28
const (
29
29
longDescription = `
30
- Outputs shell completion for the given shell (bash or zsh)
30
+ Outputs shell completion for the given shell (bash, fish or zsh)
31
31
32
32
This depends on the bash-completion binary. Example installation instructions:
33
33
OS X:
34
34
$ brew install bash-completion
35
35
$ source $(brew --prefix)/etc/bash_completion
36
36
$ skaffold completion bash > ~/.skaffold-completion # for bash users
37
+ $ skaffold completion fish > ~/.skaffold-completion # for fish users
37
38
$ skaffold completion zsh > ~/.skaffold-completion # for zsh users
38
39
$ source ~/.skaffold-completion
39
40
Ubuntu:
40
41
$ apt-get install bash-completion
41
42
$ source /etc/bash-completion
42
43
$ source <(skaffold completion bash) # for bash users
44
+ $ skaffold completion fish | source # for fish users
43
45
$ source <(skaffold completion zsh) # for zsh users
44
46
45
47
Additionally, you may want to output the completion to a file and source in your .bashrc
@@ -52,6 +54,8 @@ func completion(cmd *cobra.Command, args []string) {
52
54
switch args [0 ] {
53
55
case "bash" :
54
56
rootCmd (cmd ).GenBashCompletion (os .Stdout )
57
+ case "fish" :
58
+ rootCmd (cmd ).GenFishCompletion (os .Stdout , true )
55
59
case "zsh" :
56
60
runCompletionZsh (cmd , os .Stdout )
57
61
}
@@ -67,8 +71,8 @@ func NewCmdCompletion() *cobra.Command {
67
71
}
68
72
return cobra .OnlyValidArgs (cmd , args )
69
73
},
70
- ValidArgs : []string {"bash" , "zsh" },
71
- Short : "Output shell completion for the given shell (bash or zsh)" ,
74
+ ValidArgs : []string {"bash" , "fish" , " zsh" },
75
+ Short : "Output shell completion for the given shell (bash, fish or zsh)" ,
72
76
Long : longDescription ,
73
77
Run : completion ,
74
78
}
0 commit comments