From 5b03eac7cb9e7b5c736e217d8a63b4ac14af28be Mon Sep 17 00:00:00 2001 From: demo Date: Thu, 28 May 2026 22:24:14 -0400 Subject: feat: handle invalid arguments to 'do' --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 26bbce2..6472554 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,16 @@ func main() { }, Action: func(ctx context.Context, cmd *cli.Command) error { taskIndex := cmd.IntArg("taskIndex") + + // If taskIndex is 0, it's + // likely missing; any other + // non-positive value is a + // deliberate + // misconfiguration. + if taskIndex <= 0 { + return fmt.Errorf("invalid 'do' argument: %d", taskIndex) + } + fmt.Println("completed task: ", taskIndex) return nil }, -- cgit v1.2.3