| 41 | } |
| 42 | |
| 43 | func newTodoListCommand() *todoListCommand { |
| 44 | todoListCommand := &todoListCommand{} |
| 45 | todoListCommand.cmd = &cobra.Command{ |
| 46 | Use: "list", |
| 47 | Short: "List todos", |
| 48 | Example: ` hey todo list |
| 49 | hey todo list --limit 10 |
| 50 | hey todo list --json`, |
| 51 | RunE: todoListCommand.run, |
| 52 | } |
| 53 | |
| 54 | todoListCommand.cmd.Flags().IntVar(&todoListCommand.limit, "limit", 0, "Maximum number of todos to show") |
| 55 | todoListCommand.cmd.Flags().BoolVar(&todoListCommand.all, "all", false, "Fetch all results (override --limit)") |
| 56 | |
| 57 | return todoListCommand |
| 58 | } |
| 59 | |
| 60 | func (c *todoListCommand) run(cmd *cobra.Command, args []string) error { |
| 61 | if err := requireAuth(); err != nil { |