Skip to content

Commit 4f04bf2

Browse files
snichmejage
authored andcommitted
completions for fish shell
1 parent 72634d6 commit 4f04bf2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cmd/completion.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
var completionCmd = &cobra.Command{
10-
Use: "completion [zsh]",
10+
Use: "completion [zsh|fish]",
1111
Short: "Generate shell completion script",
1212
Long: `Generate shell completion script for cloudamqp CLI.
1313
@@ -21,15 +21,20 @@ Zsh:
2121
# To load completions for each session, add the script to your zsh completion directory:
2222
cloudamqp completion zsh > "${fpath[1]}/_cloudamqp"
2323
24-
# You may need to restart your shell for completions to take effect.
24+
Fish:
25+
cloudamqp completion zsh > "$XDG_CONFIG_HOME/fish/completions/cloudamqp.fish"
26+
27+
# You may need to restart your shell for completions to take effect.
2528
`,
2629
DisableFlagsInUseLine: true,
27-
ValidArgs: []string{"zsh"},
30+
ValidArgs: []string{"zsh", "fish"},
2831
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
2932
RunE: func(cmd *cobra.Command, args []string) error {
3033
switch args[0] {
3134
case "zsh":
3235
return cmd.Root().GenZshCompletion(os.Stdout)
36+
case "fish":
37+
return cmd.Root().GenFishCompletion(os.Stdout, false)
3338
}
3439
return nil
3540
},

0 commit comments

Comments
 (0)