]> sourceware.org Git - systemtap.git/commitdiff
Don't print usage text on stap option errors
authorJosh Stone <jistone@redhat.com>
Sat, 4 Aug 2012 21:12:33 +0000 (14:12 -0700)
committerJosh Stone <jistone@redhat.com>
Sat, 4 Aug 2012 21:12:33 +0000 (14:12 -0700)
The help text is so long that it tends to push the actual error message
off the screen.  Instead, just print a suggestion to consult --help.

session.cxx

index 067a507c8bea6af45659ef79297b4471e53c666e..52de05f07d77bc9eb215f3fe092d414bd1a53694 100644 (file)
@@ -434,6 +434,14 @@ systemtap_session::version ()
 void
 systemtap_session::usage (int exitcode)
 {
+  // For error cases, just suggest --help, so we don't obscure
+  // the actual error message with all the help text.
+  if (exitcode != EXIT_SUCCESS)
+    {
+      clog << _("Try '--help' for more information.") << endl;
+      throw exit_exception(exitcode);
+    }
+
   version ();
   clog
     << endl
@@ -1264,7 +1272,7 @@ systemtap_session::parse_cmdline (int argc, char * const argv [])
          // Invalid/unrecognized option given or argument required, but
          // not given. In both cases getopt_long() will have printed the
          // appropriate error message to stderr already.
-         return 1;
+         usage(1);
          break;
 
         default:
This page took 0.032142 seconds and 5 git commands to generate.