From 32f2ce19cc5e96cf34c8be1da9308412a4010383 Mon Sep 17 00:00:00 2001 From: demo Date: Fri, 29 May 2026 11:40:56 -0400 Subject: feat: add an "undo" command This puts a task back in the TODO state. Some refactoring here lets us reuse the same code for handling both cmdDo and cmdUndo. --- main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 85bfa26..7838fcb 100644 --- a/main.go +++ b/main.go @@ -81,6 +81,25 @@ func main() { return ctrl.cmdDo(taskIndex) }, }, + { + Name: "undo", + Aliases: []string{"u"}, + Usage: "reset a task on the list", + Arguments: []cli.Argument{ + &cli.IntArg{ + Name: "taskIndex", + }, + }, + Action: func(ctx context.Context, cmd *cli.Command) error { + taskIndex := cmd.IntArg("taskIndex") + + if taskIndex <= 0 { + return fmt.Errorf("invalid 'undo' argument: %d", taskIndex) + } + + return ctrl.cmdUndo(taskIndex) + }, + }, { Name: "list", Aliases: []string{"l"}, -- cgit v1.2.3