From 1565290e92ff06b16111e71174498a0ca118f6a5 Mon Sep 17 00:00:00 2001 From: Owajigbanam Ogbuluijah Date: Sun, 21 May 2023 08:59:52 +0000 Subject: [PATCH] Guard against no arguments to edit command Closes gammons/ultralist#268 --- cmd/edit.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/edit.go b/cmd/edit.go index bccd3413..f10692c1 100644 --- a/cmd/edit.go +++ b/cmd/edit.go @@ -41,6 +41,10 @@ func init() { Long: longDesc, Short: editCmdDesc, Run: func(cmd *cobra.Command, args []string) { + if len(args) <= 0 { + fmt.Print("edit needs arguments. See ultralist e[dit] -h.\n") + return + } todoID, err := strconv.Atoi(args[0]) if err != nil { fmt.Printf("Could not parse todo ID: '%s'\n", args[0])