package main import ( "os" "github.com/spf13/cobra" ) var completionCmd = &cobra.Command{ Use: "completion", Short: "Generates bash completion scripts", Example: `To load completion run . <(tk completion) To configure your bash shell to load completions for each session add to your bashrc # ~/.bashrc or ~/.profile . <(tk completion) `, Run: func(cmd *cobra.Command, args []string) { rootCmd.GenBashCompletion(os.Stdout) }, } func init() { rootCmd.AddCommand(completionCmd) }