Merge pull request #213 from ByStones/pwd

Allow setting "--path" even if os.Getwd() fails
This commit is contained in:
xenolf 2016-05-18 00:06:12 +02:00
commit 7a24c51c48

13
cli.go
View file

@ -41,11 +41,18 @@ func main() {
acme.UserAgent = "lego/" + app.Version
defaultPath := ""
cwd, err := os.Getwd()
if err != nil {
logger().Fatal("Could not determine current working directory. Please pass --path.")
if err == nil {
defaultPath = path.Join(cwd, ".lego")
}
app.Before = func(c *cli.Context) error {
if c.GlobalString("path") == "" {
logger().Fatal("Could not determine current working directory. Please pass --path.")
}
return nil
}
defaultPath := path.Join(cwd, ".lego")
app.Commands = []cli.Command{
{