Skip to content

Commit

Permalink
Handle invalid CLI flags (#421)
Browse files Browse the repository at this point in the history
Previously, the flags were not handled so the application would
Looking at the documentation for https://github.com/urfave/cli , the error is propogated up through the `app.Run` call.
Now, the error is checked before fatally logging it.

closes #420
  • Loading branch information
mkobit authored and aelsabbahy committed May 12, 2019
1 parent 641180c commit 5b23ea2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/goss/goss.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"os"
"time"

Expand Down Expand Up @@ -286,11 +287,11 @@ func main() {
Value: 5 * time.Second,
},
cli.StringFlag{
Name: "username, u",
Name: "username, u",
Usage: "Username for basic auth",
},
cli.StringFlag{
Name: "password, p",
Name: "password, p",
Usage: "Password for basic auth",
},
},
Expand Down Expand Up @@ -335,6 +336,9 @@ func main() {
},
}

app.Run(os.Args)
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}

}

0 comments on commit 5b23ea2

Please sign in to comment.