Skip to content

Commit 4f314d4

Browse files
authored
feat: completion for the Fish shell (#8097)
1 parent 2e314a5 commit 4f314d4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cmd/skaffold/app/cmd/completion.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ import (
2727

2828
const (
2929
longDescription = `
30-
Outputs shell completion for the given shell (bash or zsh)
30+
Outputs shell completion for the given shell (bash, fish or zsh)
3131
3232
This depends on the bash-completion binary. Example installation instructions:
3333
OS X:
3434
$ brew install bash-completion
3535
$ source $(brew --prefix)/etc/bash_completion
3636
$ skaffold completion bash > ~/.skaffold-completion # for bash users
37+
$ skaffold completion fish > ~/.skaffold-completion # for fish users
3738
$ skaffold completion zsh > ~/.skaffold-completion # for zsh users
3839
$ source ~/.skaffold-completion
3940
Ubuntu:
4041
$ apt-get install bash-completion
4142
$ source /etc/bash-completion
4243
$ source <(skaffold completion bash) # for bash users
44+
$ skaffold completion fish | source # for fish users
4345
$ source <(skaffold completion zsh) # for zsh users
4446
4547
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) {
5254
switch args[0] {
5355
case "bash":
5456
rootCmd(cmd).GenBashCompletion(os.Stdout)
57+
case "fish":
58+
rootCmd(cmd).GenFishCompletion(os.Stdout, true)
5559
case "zsh":
5660
runCompletionZsh(cmd, os.Stdout)
5761
}
@@ -67,8 +71,8 @@ func NewCmdCompletion() *cobra.Command {
6771
}
6872
return cobra.OnlyValidArgs(cmd, args)
6973
},
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)",
7276
Long: longDescription,
7377
Run: completion,
7478
}

docs/content/en/docs/references/cli/_index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Getting Started With a New Project:
8585
init Generate configuration for deploying an application
8686
8787
Other Commands:
88-
completion Output shell completion for the given shell (bash or zsh)
88+
completion Output shell completion for the given shell (bash, fish or zsh)
8989
config Interact with the global Skaffold config file (defaults to `$HOME/.skaffold/config`)
9090
diagnose Run a diagnostic on Skaffold
9191
fix Update old configuration to a newer schema version
@@ -280,7 +280,7 @@ Env vars:
280280

281281
### skaffold completion
282282

283-
Output shell completion for the given shell (bash or zsh)
283+
Output shell completion for the given shell (bash, fish or zsh)
284284

285285
```
286286

0 commit comments

Comments
 (0)