()
| 38 | } |
| 39 | |
| 40 | func newHabitCompleteCommand() *habitCompleteCommand { |
| 41 | habitCompleteCommand := &habitCompleteCommand{} |
| 42 | habitCompleteCommand.cmd = &cobra.Command{ |
| 43 | Use: "complete <id>", |
| 44 | Short: "Mark a habit as complete for a date", |
| 45 | Example: ` hey habit complete 789 |
| 46 | hey habit complete 789 --date 2024-01-15`, |
| 47 | RunE: habitCompleteCommand.run, |
| 48 | Args: usageExactOneArg(), |
| 49 | } |
| 50 | |
| 51 | habitCompleteCommand.cmd.Flags().StringVar(&habitCompleteCommand.date, "date", "", "Date (YYYY-MM-DD, default: today)") |
| 52 | |
| 53 | return habitCompleteCommand |
| 54 | } |
| 55 | |
| 56 | func (c *habitCompleteCommand) run(cmd *cobra.Command, args []string) error { |
| 57 | if err := requireAuth(); err != nil { |
no test coverage detected