]> git.cworth.org Git - apitrace/commitdiff
trim: Complain if given extraneous arguments.
authorCarl Worth <cworth@cworth.org>
Tue, 4 Sep 2012 23:48:00 +0000 (16:48 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 22 Nov 2012 08:02:55 +0000 (08:02 +0000)
Previously additional arguments were silently ignored, (which can lead
to confusion if the user expects to be able to specify a bare callset
on the command line rather than specifying a --calls option).

cli/cli_trim.cpp

index c54565f8e983ec1d5173aa6c221506cd4b6432fb..75670af93f7f7ce9b281a40f6edd3e115569732a 100644 (file)
@@ -253,6 +253,16 @@ command(int argc, char *argv[])
         return 1;
     }
 
+    if (argc > optind + 1) {
+        std::cerr << "error: extraneous arguments:";
+        for (int i = optind + 1; i < argc; i++) {
+            std::cerr << " " << argv[i];
+        }
+        std::cerr << "\n";
+        usage();
+        return 1;
+    }
+
     return trim_trace(argv[optind], &options);
 }