forked from bpicode/fritzctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
completion_zsh.go
29 lines (22 loc) · 853 Bytes
/
completion_zsh.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cmd
import (
"os"
"github.com/spf13/cobra"
)
var completionZshCmd = &cobra.Command{
Use: "zsh",
Short: "Outputs fritzctl shell completion for the given shell (zsh)",
Long: `Outputs fritzctl shell completion for the given shell (zsh) to stdout.
Completion functions for need to be stored a file called _fritzctl and this file needs to be placed in a directory listed in the $fpath variable.
Afterwards restart the shell or run
autoload -U compinit && compinit
to make zsh aware of the changes.`,
Example: "sudo sh -c '/path/to/fritzctl completion zsh > /usr/share/zsh/vendor-completions/_fritzctl' && autoload -U compinit && compinit",
RunE: completionZsh,
}
func init() {
completionCmd.AddCommand(completionZshCmd)
}
func completionZsh(cmd *cobra.Command, args []string) error {
return RootCmd.GenZshCompletion(os.Stdout)
}