diff options
author | Raymaekers Luca <luca@spacehb.net> | 2025-01-08 19:01:42 +0100 |
---|---|---|
committer | Raymaekers Luca <luca@spacehb.net> | 2025-01-08 19:01:42 +0100 |
commit | 4619bac708604fa2d3c2e5588f0e1a751c971c93 (patch) | |
tree | d764157f9b7de1178c5af51ea1749feed146b57d | |
parent | 17197ee1db2a196b3a78baa328bbb73400381823 (diff) |
Require -n when deleting a task as security
-rw-r--r-- | ws/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -460,10 +460,15 @@ func main() { var shouldDeleteDone bool flagSet := flag.NewFlagSet("del", flag.ExitOnError) - flagSet.IntVar(&n, "n", 1, "Set task number") + flagSet.IntVar(&n, "n", 0, "Set task number") flagSet.BoolVar(&shouldDeleteDone, "d", false, "Should delete a done task") flagSet.Parse(os.Args[2:]) + if n == 0 { + fmt.Println("Task number is required.") + os.Exit(1) + } + if !shouldDeleteDone { if len(TasksDo) == 0 { fmt.Println("No tasks to edit.") |