Skip to content

Commit

Permalink
Merge pull request prometheus#1828 from drawks/iss-1821
Browse files Browse the repository at this point in the history
Error on non-flag commandline arguments
  • Loading branch information
juliusv authored Jul 20, 2016
2 parents 12709af + 00ea36c commit 08891be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/prometheus/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,13 @@ func init() {

func parse(args []string) error {
err := cfg.fs.Parse(args)
if err != nil {
if err != nil || len(cfg.fs.Args()) != 0 {
if err != flag.ErrHelp {
log.Errorf("Invalid command line arguments. Help: %s -h", os.Args[0])
}
if err == nil {
err = fmt.Errorf("Non-flag argument on command line: %q", cfg.fs.Args()[0])
}
return err
}

Expand Down

0 comments on commit 08891be

Please sign in to comment.