summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
},