17840: Check for unparsed command line arguments.
[arvados.git] / services / crunch-dispatch-local / crunch-dispatch-local.go
index a3cb1341a4677e7ecdc7c03976da7483e47c1aa5..159ee69b1215b205dd904f14449e2bbaaa53a9a8 100644 (file)
@@ -67,7 +67,14 @@ func doMain() error {
                "Print version information and exit.")
 
        // Parse args; omit the first arg which is the command name
-       flags.Parse(os.Args[1:])
+       err := flags.Parse(os.Args[1:])
+       if err == flag.ErrHelp {
+               return nil
+       } else if err != nil {
+               return err
+       } else if flags.NArg() != 0 {
+               return fmt.Errorf("unrecognized command line arguments: %v", flags.Args())
+       }
 
        // Print version information if requested
        if *getVersion {