diff --git a/examples/Makefile.am b/examples/Makefile.am index 4d715f1..c885f78 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,5 +1,5 @@ -noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 +noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test1_SOURCES = test1.cpp test2_SOURCES = test2.cpp @@ -9,6 +9,7 @@ test5_SOURCES = test5.cpp test6_SOURCES = test6.cpp test7_SOURCES = test7.cpp test8_SOURCES = test8.cpp +test9_SOURCES = test9.cpp INCLUDES = -I$(top_builddir)/include diff --git a/examples/test9.cpp b/examples/test9.cpp new file mode 100644 index 0000000..f3a0057 --- /dev/null +++ b/examples/test9.cpp @@ -0,0 +1,43 @@ +#include +#include +#include +#include + +using namespace TCLAP; +using namespace std; + +int main(int argc, char** argv) +{ + try { + + CmdLine cmd("Command description message", ' ', "0.9",false); + + SwitchArg reverseSwitch("r","reverse","REVERSE instead of FORWARDS", false); + cmd.add( reverseSwitch ); + + MultiSwitchArg verbose("V","verbose","Level of verbosity"); + cmd.add( verbose ); + + MultiSwitchArg noise("N","noise","Level of noise",5); + cmd.add( noise ); + + cmd.parse( argc, argv ); + + bool reverseName = reverseSwitch.getValue(); + + if ( reverseName ) + cout << "REVERSE" << endl; + else + cout << "FORWARD" << endl; + + if ( verbose.isSet() ) + cout << "Verbose level: " << verbose.getValue() << endl; + + if ( noise.isSet() ) + cout << "Noise level: " << noise.getValue() << endl; + + + } catch (ArgException &e) // catch any exceptions + { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } +} + diff --git a/include/tclap/Makefile.am b/include/tclap/Makefile.am index 7f71859..3640f58 100644 --- a/include/tclap/Makefile.am +++ b/include/tclap/Makefile.am @@ -13,6 +13,7 @@ libtclapinclude_HEADERS = \ Visitor.h Arg.h \ HelpVisitor.h \ SwitchArg.h \ + MultiSwitchArg.h \ VersionVisitor.h \ IgnoreRestVisitor.h \ CmdLineOutput.h \