From ae79f998769cdd62dbf856db0b3b53528b532438 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 3 Dec 2019 15:21:59 +0100 Subject: Parse SMTP URL from CLI --- cmd/koushin/main.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/koushin/main.go b/cmd/koushin/main.go index 6e364cb..d30cb85 100644 --- a/cmd/koushin/main.go +++ b/cmd/koushin/main.go @@ -9,14 +9,19 @@ import ( ) func main() { - if len(os.Args) != 2 { - fmt.Println("usage: koushin imaps://:") + if len(os.Args) != 2 && len(os.Args) != 3 { + fmt.Println("usage: koushin [SMTP URL]") return } - url := os.Args[1] + imapURL := os.Args[1] - e := koushin.New(url) + var smtpURL string + if len(os.Args) == 3 { + smtpURL = os.Args[2] + } + + e := koushin.New(imapURL, smtpURL) e.Use(middleware.Logger()) e.Use(middleware.Recover()) e.Logger.Fatal(e.Start(":1323")) -- cgit v1.2.3