package main import ( "fmt" "os" "github.com/spf13/cobra" ) // Root Command var rootCmd = &cobra.Command{ Use: "wonder", Short: "Here we go", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Here we go") }, } // Echo Command var echoCmd = &cobra.Command{ Use: "girlfriend", Run: func(cmd *cobra.Command, args []string) { fmt.Println("I love my girlfriend") }, } // main func main() { // Add rootCmd.AddCommand(echoCmd) // Exec if err := rootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } }