From d43684cd901b4a6d6e9c1439e762bd06d3b16f4a Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Tue, 16 Jul 2019 12:09:25 +0200 Subject: Show usage on getopt.Getopts error --- aerc.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aerc.go b/aerc.go index dafdd22..40e6605 100644 --- a/aerc.go +++ b/aerc.go @@ -92,11 +92,16 @@ var ( Version string ) +func usage() { + log.Fatal("Usage: aerc [-v]") +} + func main() { // TODO: Support starting with mailto links, ad-hoc accounts, etc opts, optind, err := getopt.Getopts(os.Args, "v") if err != nil { - panic(err) + log.Print(err) + usage() } for _, opt := range opts { switch opt.Option { @@ -106,7 +111,7 @@ func main() { } } if optind != len(os.Args) { - log.Fatal("Usage: aerc [-v]") + usage() } var ( -- cgit v1.2.3