From dc57d2d8ba76505e5a4b127780d2ce5565e53084 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Tue, 15 Dec 2015 19:18:51 +0100 Subject: [PATCH 1/2] cli fixes for short args --- cli_handlers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli_handlers.go b/cli_handlers.go index 7f44e88c..05fff6f0 100644 --- a/cli_handlers.go +++ b/cli_handlers.go @@ -27,7 +27,7 @@ func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) { } conf := NewConfiguration(c) - if !c.GlobalIsSet("email") { + if len(c.GlobalString(email)) == 0 { logger().Fatal("You have to pass an account (email address) to the program using --email or -m") } @@ -122,8 +122,8 @@ func run(c *cli.Context) { } } - if !c.GlobalIsSet("domains") { - logger().Fatal("Please specify --domains") + if len(c.GlobalStringSlice(domains)) == 0 { + logger().Fatal("Please specify --domains or -d") } cert, failures := client.ObtainSANCertificate(c.GlobalStringSlice("domains"), true) @@ -131,7 +131,7 @@ func run(c *cli.Context) { for k, v := range failures { logger().Printf("[%s] Could not obtain certificates\n\t%s", k, v.Error()) } - + // Make sure to return a non-zero exit code if ObtainSANCertificate // returned at least one error. Due to us not returning partial // certificate we can just exit here instead of at the end. @@ -192,7 +192,7 @@ func renew(c *cli.Context) { logger().Printf("Could not get Certification expiration for domain %s", domain) } - if int(expTime.Sub(time.Now()).Hours() / 24.0) <= c.Int("days") { + if int(expTime.Sub(time.Now()).Hours()/24.0) <= c.Int("days") { continue } } From 0edc4b5aaa0e8ca06b0d41b7aa7bfef7508fc0bf Mon Sep 17 00:00:00 2001 From: Gianluca Date: Tue, 15 Dec 2015 19:21:46 +0100 Subject: [PATCH 2/2] typo fix --- cli_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli_handlers.go b/cli_handlers.go index 05fff6f0..b330753f 100644 --- a/cli_handlers.go +++ b/cli_handlers.go @@ -27,7 +27,7 @@ func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) { } conf := NewConfiguration(c) - if len(c.GlobalString(email)) == 0 { + if len(c.GlobalString("email")) == 0 { logger().Fatal("You have to pass an account (email address) to the program using --email or -m") } @@ -122,7 +122,7 @@ func run(c *cli.Context) { } } - if len(c.GlobalStringSlice(domains)) == 0 { + if len(c.GlobalStringSlice("domains")) == 0 { logger().Fatal("Please specify --domains or -d") }