Skip to content

Commit

Permalink
check args count before parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Krou committed Nov 16, 2017
1 parent 6e5cdca commit 353b8f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ func main() {
fmt.Fprintf(os.Stderr, " %s [YAML FILE OR URL]\n\n", os.Args[0])
flagSet.PrintDefaults()
}
flagSet.Parse(os.Args[2:])
if len(os.Args) < 2 {
fmt.Fprintln(os.Stderr, "you need to provide the file path or url to load")
os.Exit(1)
}
flagSet.Parse(os.Args[2:])
json, err := YAMLDoc(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
Expand Down

0 comments on commit 353b8f3

Please sign in to comment.