diff options
| author | demo <demo@antix1> | 2026-05-28 22:24:14 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-28 22:24:14 -0400 |
| commit | 5b03eac7cb9e7b5c736e217d8a63b4ac14af28be (patch) | |
| tree | 56915c7ec5b54f75e7211682b6bdc49f5b0f5d85 /main.go | |
| parent | b6745b7bbe53678e00f4876234ff08b353c7c34c (diff) | |
feat: handle invalid arguments to 'do'
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 }, |
