github.com/zaquestion/lab@v0.25.1/cmd/todo.go (about) 1 package cmd 2 3 import ( 4 "github.com/spf13/cobra" 5 ) 6 7 var todoCmd = &cobra.Command{ 8 Use: "todo", 9 Short: "Check out the todo list for MR or issues", 10 PersistentPreRun: labPersistentPreRun, 11 Run: func(cmd *cobra.Command, args []string) { 12 if list, _ := cmd.Flags().GetBool("list"); list { 13 todoListCmd.Run(cmd, args) 14 return 15 } 16 if done, _ := cmd.Flags().GetBool("done"); done { 17 todoDoneCmd.Run(cmd, args) 18 return 19 } 20 21 if len(args) == 0 || len(args) > 2 { 22 cmd.Help() 23 return 24 } 25 }, 26 } 27 28 func init() { 29 RootCmd.AddCommand(todoCmd) 30 }