[cig-commits] r13535 - cs/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Tue Dec 9 18:13:34 PST 2008


Author: luis
Date: 2008-12-09 18:13:33 -0800 (Tue, 09 Dec 2008)
New Revision: 13535

Modified:
   cs/cigma/trunk/src/cli_base_cmd.cpp
   cs/cigma/trunk/src/cli_base_cmd.h
Log:
Added second section to command options

Modified: cs/cigma/trunk/src/cli_base_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_base_cmd.cpp	2008-12-10 02:13:32 UTC (rev 13534)
+++ cs/cigma/trunk/src/cli_base_cmd.cpp	2008-12-10 02:13:33 UTC (rev 13535)
@@ -26,6 +26,12 @@
         cout << opts << endl;
     }
 
+    if (other.options().size() > 0)
+    {
+        cout << other_section << endl;
+        cout << other << endl;
+    }
+
     if (appendix != "")
     {
         cout << appendix << endl;
@@ -34,13 +40,24 @@
 
 void BaseCmd::defineOptions()
 {
+    // main options
     opts_section = "Options: ";
-    opts.add_options()("help,h", "produce help message");
+    //opts.add_options()("help,h", "produce help message");
+
+    // other options
+    other_section = "Other Options: ";
+    other.add_options()
+        ("help,h", "produce help message")
+        ("verbose,v", "produce verbose output")
+        ("debug,D", "print debugging information")
+        ;
 }
 
 void BaseCmd::parseOptions(int argc, char *argv[])
 {
-    po::store(po::command_line_parser(argc, argv).options(opts).positional(args).run(), vm);
+    po::options_description all;
+    all.add(opts).add(other);
+    po::store(po::command_line_parser(argc, argv).options(all).positional(args).run(), vm);
 }
 
 void BaseCmd::configure()

Modified: cs/cigma/trunk/src/cli_base_cmd.h
===================================================================
--- cs/cigma/trunk/src/cli_base_cmd.h	2008-12-10 02:13:32 UTC (rev 13534)
+++ cs/cigma/trunk/src/cli_base_cmd.h	2008-12-10 02:13:33 UTC (rev 13535)
@@ -47,7 +47,9 @@
 
 public:
     std::string opts_section;
+    std::string other_section;
     boost::program_options::options_description opts;
+    boost::program_options::options_description other;
     boost::program_options::positional_options_description args;
     boost::program_options::variables_map vm;
 };



More information about the CIG-COMMITS mailing list