17840: Check for unparsed command line arguments.
[arvados.git] / lib / diagnostics / cmd.go
index b0241b3ae412634f734e4632c03ba5c5c2b6cbf0..8663c6ee5fab61bb24ad6966347cbc77d22f908d 100644 (file)
@@ -39,6 +39,9 @@ func (cmd Command) RunCommand(prog string, args []string, stdin io.Reader, stdou
        } else if err != nil {
                fmt.Fprintln(stderr, err)
                return 2
+       } else if f.NArg() != 0 {
+               fmt.Fprintf(stderr, "unrecognized command line arguments: %v\n", f.Args())
+               return 2
        }
        diag.logger = ctxlog.New(stdout, "text", diag.logLevel)
        diag.logger.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true, DisableLevelTruncation: true, PadLevelText: true})