From 9c64140e68d236b6b8bbe90157b60cb9eb35506d Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Sun, 20 Jul 2014 16:13:16 +0100 Subject: Added poll removal option --- blavote.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'blavote.go') diff --git a/blavote.go b/blavote.go index a27742a..48e1ae2 100644 --- a/blavote.go +++ b/blavote.go @@ -13,7 +13,7 @@ var version string func main() { - version = "0.1" + version = "0.2" //Command line arguments var opts struct { @@ -21,6 +21,7 @@ func main() { Add string `short:"a" long:"add" description:"Title for a new poll"` New string `short:"n" long:"new" description:"Title for a new poll"` Username string `short:"u" long:"username" description:"Username of user adding poll"` + Remove int `short:"r" long:"remove" description:"ID of a poll to delete"` Args struct { Rest []string @@ -73,6 +74,16 @@ func main() { } else { fmt.Println(err) } + } else if (opts.Remove > 0) { + deletePoll(db, opts.Remove) + + if (err == nil) { + fmt.Print("Poll removed with ID ") + fmt.Println(opts.Remove) + } else { + fmt.Println(err) + } + } else { fmt.Println(opts.Args.Rest) vote(db, opts.Username, opts.Args.Rest) -- cgit v1.2.3