[MOAB-dev] r4885 - MOAB/trunk/tools

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu May 26 16:03:50 CDT 2011


Author: kraftche
Date: 2011-05-26 16:03:50 -0500 (Thu, 26 May 2011)
New Revision: 4885

Modified:
   MOAB/trunk/tools/ProgOptions.cpp
   MOAB/trunk/tools/ProgOptions.hpp
Log:
Some minor additions to ProgOptions

o New option flag: int_flag.  Allows flags of the form -<n>, where n
  is some integer digit (mbconvert and mbpart have options like that)

o Allow getOpt<void> to be called for flag options with a NULL pointer

o Add hidden option --manpage to write help to stdout formatted as Unix man page


Modified: MOAB/trunk/tools/ProgOptions.cpp
===================================================================
--- MOAB/trunk/tools/ProgOptions.cpp	2011-05-26 18:29:34 UTC (rev 4884)
+++ MOAB/trunk/tools/ProgOptions.cpp	2011-05-26 21:03:50 UTC (rev 4885)
@@ -4,6 +4,7 @@
 #include <cstdlib>
 #include <list>
 #include <limits>
+#include <set>
 
 #include <assert.h>
 #include <string.h>
@@ -45,15 +46,15 @@
   const char* get_argstring() const { 
     switch( type ){
     case INT:
-      return "<int>";
+      return "int";
     case INT_VECT:
-      return "<ints>";
+      return "ints";
     case REAL:
-      return "<val>";
+      return "val";
     case FLAG:
       return "";
     default:
-      return "<arg>";
+      return "arg";
     }
   }
 
@@ -66,11 +67,13 @@
   friend class ProgOptions;
 };
 
-ProgOptions::ProgOptions( const std::string& helpstring ) :
+ProgOptions::ProgOptions( const std::string& helpstring, const std::string& briefhelp ) :
     expect_optional_args(false)
 {
-  main_help.push_back( helpstring );
-  addOpt<void>( "help,h", "Show full help text", help_flag );
+  brief_help = briefhelp;
+  if (!helpstring.empty())
+    main_help.push_back( helpstring );
+ addOpt<void>( "help,h", "Show full help text", help_flag );
 }
 
 ProgOptions::~ProgOptions(){
@@ -111,6 +114,16 @@
 


More information about the moab-dev mailing list