summary refs log tree commit diff stats
path: root/aerc.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-07-19 14:34:13 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-19 14:34:13 -0400
commit66a9052f0fa8d2caf0d82435241b10e9ba8665b2 (patch)
treeb4b350794eb5850806be0936a9146007c4777383 /aerc.go
parent7a489cb0011a34a68d3e77d0174076857cc37902 (diff)
downloadaerc-66a9052f0fa8d2caf0d82435241b10e9ba8665b2.tar.gz
Forward mailto links to server via ./aerc <mailto>
Diffstat (limited to 'aerc.go')
-rw-r--r--aerc.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/aerc.go b/aerc.go
index d44d3ba..1b313c3 100644
--- a/aerc.go
+++ b/aerc.go
@@ -94,15 +94,15 @@ var (
 )
 
 func usage() {
-	log.Fatal("Usage: aerc [-v]")
+	log.Fatal("Usage: aerc [-v] [mailto:...]")
 }
 
 func main() {
-	// TODO: Support starting with mailto links, ad-hoc accounts, etc
 	opts, optind, err := getopt.Getopts(os.Args, "v")
 	if err != nil {
 		log.Print(err)
 		usage()
+		return
 	}
 	for _, opt := range opts {
 		switch opt.Option {
@@ -111,8 +111,13 @@ func main() {
 			return
 		}
 	}
-	if optind != len(os.Args) {
+	args := os.Args[optind:]
+	if len(args) > 1 {
 		usage()
+		return
+	} else if len(args) == 1 {
+		lib.ConnectAndExec(args[0])
+		return
 	}
 
 	var (