From a5105dc72af31eef2e61739fd943f6c21f2619da Mon Sep 17 00:00:00 2001 From: Mike Smoot Date: Sun, 22 May 2011 11:50:16 -0700 Subject: [PATCH 1/4] added patch to fix brief output with TCLAP_NAMESTRING defined --- include/tclap/StdOutput.h | 3 ++- tests/Makefile.am | 6 ++++-- tests/runtests.sh | 2 +- tests/test63.sh | 0 tests/test64.sh | 0 tests/test65.sh | 0 tests/test66.sh | 0 tests/test67.sh | 0 tests/test79.out | 9 +++++++++ tests/test79.sh | 11 +++++++++++ 10 files changed, 27 insertions(+), 4 deletions(-) mode change 100644 => 100755 tests/test63.sh mode change 100644 => 100755 tests/test64.sh mode change 100644 => 100755 tests/test65.sh mode change 100644 => 100755 tests/test66.sh mode change 100644 => 100755 tests/test67.sh create mode 100644 tests/test79.out create mode 100755 tests/test79.sh diff --git a/include/tclap/StdOutput.h b/include/tclap/StdOutput.h index 35f7b99..944cff4 100644 --- a/include/tclap/StdOutput.h +++ b/include/tclap/StdOutput.h @@ -143,7 +143,8 @@ inline void StdOutput::failure( CmdLineInterface& _cmd, _shortUsage( _cmd, std::cerr ); std::cerr << std::endl << "For complete USAGE and HELP type: " - << std::endl << " " << progName << " --help" + << std::endl << " " << progName << " " + << Arg::nameStartString() << "help" << std::endl << std::endl; } else diff --git a/tests/Makefile.am b/tests/Makefile.am index 4c0f409..179f80f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -77,7 +77,8 @@ TESTS = test1.sh \ test75.sh \ test76.sh \ test77.sh \ - test78.sh + test78.sh \ + test79.sh EXTRA_DIST = $(TESTS) \ test1.out \ @@ -157,6 +158,7 @@ EXTRA_DIST = $(TESTS) \ test75.out \ test76.out \ test77.out \ - test78.out + test78.out \ + test79.out CLEANFILES = tmp.out diff --git a/tests/runtests.sh b/tests/runtests.sh index e4e64e4..b0ad68f 100644 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -2,7 +2,7 @@ let "suc = 0" let "fail = 0" -NUMTEST=67 +NUMTEST=79 for (( tno = 1 ; $tno <= $NUMTEST ; tno = $tno + 1 )); do ./testCheck.sh $tno diff --git a/tests/test63.sh b/tests/test63.sh old mode 100644 new mode 100755 diff --git a/tests/test64.sh b/tests/test64.sh old mode 100644 new mode 100755 diff --git a/tests/test65.sh b/tests/test65.sh old mode 100644 new mode 100755 diff --git a/tests/test66.sh b/tests/test66.sh old mode 100644 new mode 100755 diff --git a/tests/test67.sh b/tests/test67.sh old mode 100644 new mode 100755 diff --git a/tests/test79.out b/tests/test79.out new file mode 100644 index 0000000..9e7b467 --- /dev/null +++ b/tests/test79.out @@ -0,0 +1,9 @@ +PARSE ERROR: + Required argument missing: name + +Brief USAGE: + ../examples/test21 [/r] /n [//] [~~version] [/h] + +For complete USAGE and HELP type: + ../examples/test21 ~~help + diff --git a/tests/test79.sh b/tests/test79.sh new file mode 100755 index 0000000..62f5c02 --- /dev/null +++ b/tests/test79.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# success +../examples/test21 > tmp.out 2>&1 + +if cmp -s tmp.out $srcdir/test79.out; then + exit 0 +else + exit 1 +fi + From fdce4f38f0fe6f95d614484f15fb2a31d21f5626 Mon Sep 17 00:00:00 2001 From: Mike Smoot Date: Sun, 22 May 2011 12:05:21 -0700 Subject: [PATCH 2/4] Allows xor args to be optional --- include/tclap/CmdLine.h | 21 ++++++++++++--------- include/tclap/CmdLineInterface.h | 6 ++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h index 0fec8d8..fc47ed8 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h @@ -224,15 +224,17 @@ private: * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. + * \param required - Require at least one option (defaults to true) */ - void xorAdd( Arg& a, Arg& b ); + void xorAdd( Arg& a, Arg& b, bool required=true ); /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. + * \param required - Require at least one option (defaults to true) */ - void xorAdd( std::vector& xors ); + void xorAdd( std::vector& xors, bool required=true ); /** * Parses the command line. @@ -390,24 +392,25 @@ inline void CmdLine::_constructor() deleteOnExit(v); } -inline void CmdLine::xorAdd( std::vector& ors ) +inline void CmdLine::xorAdd( std::vector& ors, bool required ) { _xorHandler.add( ors ); - for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) - { - (*it)->forceRequired(); - (*it)->setRequireLabel( "OR required" ); + for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) { + if (required) { + (*it)->forceRequired(); + (*it)->setRequireLabel( "OR required" ); + } add( *it ); } } -inline void CmdLine::xorAdd( Arg& a, Arg& b ) +inline void CmdLine::xorAdd( Arg& a, Arg& b, bool required ) { std::vector ors; ors.push_back( &a ); ors.push_back( &b ); - xorAdd( ors ); + xorAdd( ors, required ); } inline void CmdLine::add( Arg& a ) diff --git a/include/tclap/CmdLineInterface.h b/include/tclap/CmdLineInterface.h index 1b25e9b..9f17d70 100644 --- a/include/tclap/CmdLineInterface.h +++ b/include/tclap/CmdLineInterface.h @@ -67,15 +67,17 @@ class CmdLineInterface * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. + * \param required - Require at least one option (defaults to true) */ - virtual void xorAdd( Arg& a, Arg& b )=0; + virtual void xorAdd( Arg& a, Arg& b, bool required=true )=0; /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. + * \param required - Require at least one option (defaults to true) */ - virtual void xorAdd( std::vector& xors )=0; + virtual void xorAdd( std::vector& xors, bool required=true )=0; /** * Parses the command line. From 2fee9bc48e644dc858aa405ed0957c05abb3e8a5 Mon Sep 17 00:00:00 2001 From: Mike Smoot Date: Sun, 22 May 2011 12:41:48 -0700 Subject: [PATCH 3/4] reverted changes? --- include/tclap/CmdLine.h | 21 +++++++++------------ include/tclap/CmdLineInterface.h | 6 ++---- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/tclap/CmdLine.h b/include/tclap/CmdLine.h index fc47ed8..0fec8d8 100644 --- a/include/tclap/CmdLine.h +++ b/include/tclap/CmdLine.h @@ -224,17 +224,15 @@ private: * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. - * \param required - Require at least one option (defaults to true) */ - void xorAdd( Arg& a, Arg& b, bool required=true ); + void xorAdd( Arg& a, Arg& b ); /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. - * \param required - Require at least one option (defaults to true) */ - void xorAdd( std::vector& xors, bool required=true ); + void xorAdd( std::vector& xors ); /** * Parses the command line. @@ -392,25 +390,24 @@ inline void CmdLine::_constructor() deleteOnExit(v); } -inline void CmdLine::xorAdd( std::vector& ors, bool required ) +inline void CmdLine::xorAdd( std::vector& ors ) { _xorHandler.add( ors ); - for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) { - if (required) { - (*it)->forceRequired(); - (*it)->setRequireLabel( "OR required" ); - } + for (ArgVectorIterator it = ors.begin(); it != ors.end(); it++) + { + (*it)->forceRequired(); + (*it)->setRequireLabel( "OR required" ); add( *it ); } } -inline void CmdLine::xorAdd( Arg& a, Arg& b, bool required ) +inline void CmdLine::xorAdd( Arg& a, Arg& b ) { std::vector ors; ors.push_back( &a ); ors.push_back( &b ); - xorAdd( ors, required ); + xorAdd( ors ); } inline void CmdLine::add( Arg& a ) diff --git a/include/tclap/CmdLineInterface.h b/include/tclap/CmdLineInterface.h index 9f17d70..1b25e9b 100644 --- a/include/tclap/CmdLineInterface.h +++ b/include/tclap/CmdLineInterface.h @@ -67,17 +67,15 @@ class CmdLineInterface * not need to be called. * \param a - Argument to be added and xor'd. * \param b - Argument to be added and xor'd. - * \param required - Require at least one option (defaults to true) */ - virtual void xorAdd( Arg& a, Arg& b, bool required=true )=0; + virtual void xorAdd( Arg& a, Arg& b )=0; /** * Add a list of Args that will be xor'd. If this method is used, * add does not need to be called. * \param xors - List of Args to be added and xor'd. - * \param required - Require at least one option (defaults to true) */ - virtual void xorAdd( std::vector& xors, bool required=true )=0; + virtual void xorAdd( std::vector& xors )=0; /** * Parses the command line. From 93fc06100386dd4a49f20f10c71b97249d4f06e3 Mon Sep 17 00:00:00 2001 From: Mike Smoot Date: Sun, 25 Nov 2012 13:25:39 -0800 Subject: [PATCH 4/4] Added git ignores --- .gitignore | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae59480 --- /dev/null +++ b/.gitignore @@ -0,0 +1,76 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +config.log +config.status +config/Makefile +# config/Makefile.in +config/config.h +config/config.h.in +config/stamp-h1 +configure +docs/Doxyfile +docs/Makefile +docs/Makefile.in +docs/html/ +examples/.deps/ +examples/Makefile +examples/Makefile.in +examples/test1 +examples/test1.o +examples/test10 +examples/test10.o +examples/test11 +examples/test11.o +examples/test12 +examples/test12.o +examples/test13 +examples/test13.o +examples/test14 +examples/test14.o +examples/test15 +examples/test15.o +examples/test16 +examples/test16.o +examples/test17 +examples/test17-a.o +examples/test17.o +examples/test18 +examples/test18.o +examples/test19 +examples/test19.o +examples/test2 +examples/test2.o +examples/test20 +examples/test20.o +examples/test21 +examples/test21.o +examples/test22 +examples/test22.o +examples/test3 +examples/test3.o +examples/test4 +examples/test4.o +examples/test5 +examples/test5.o +examples/test6 +examples/test6.o +examples/test7 +examples/test7.o +examples/test8 +examples/test8.o +examples/test9 +examples/test9.o +include/Makefile +include/Makefile.in +include/tclap/Makefile +include/tclap/Makefile.in +msc/Makefile +msc/Makefile.in +msc/examples/Makefile +msc/examples/Makefile.in +tclap.pc +tests/Makefile +tests/Makefile.in +tests/tmp.out