summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-28 22:24:14 -0400
committerdemo <demo@antix1>2026-05-28 22:24:14 -0400
commit5b03eac7cb9e7b5c736e217d8a63b4ac14af28be (patch)
tree56915c7ec5b54f75e7211682b6bdc49f5b0f5d85 /main.go
parentb6745b7bbe53678e00f4876234ff08b353c7c34c (diff)
feat: handle invalid arguments to 'do'
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
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
},