1
0
mirror of https://git.sr.ht/~sircmpwn/aerc synced 2024-11-23 16:42:07 +01:00

Show usage on getopt.Getopts error

This commit is contained in:
Asger Hautop Drewsen 2019-07-16 12:09:25 +02:00 committed by Drew DeVault
parent 41390bc3e1
commit d43684cd90

@ -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 (