aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/notifyctl/main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/notifyctl/main.go b/cmd/notifyctl/main.go
index ca1db86..e0875e7 100644
--- a/cmd/notifyctl/main.go
+++ b/cmd/notifyctl/main.go
@@ -52,6 +52,10 @@ func main() {
}
limit = n
}
+ if limit < 1 {
+ fmt.Println("[]")
+ return
+ }
printFile("history.json", limit)
case "close":
need(3)
@@ -106,7 +110,10 @@ func printFile(name string, limit int) {
return
}
var pretty any
- json.Unmarshal(data, &pretty)
+ if err := json.Unmarshal(data, &pretty); err != nil {
+ fmt.Fprintf(os.Stderr, "notifyctl: %v\n", err)
+ os.Exit(1)
+ }
out, _ := json.MarshalIndent(pretty, "", " ")
fmt.Println(string(out))
}