From c2c2c1bacb1e0d04d7325ef22d7651fb1eeef5c3 Mon Sep 17 00:00:00 2001 From: "Taylor C. Richberger" Date: Mon, 9 May 2016 17:12:46 -0600 Subject: make changes, bump version number --- args.hxx | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'args.hxx') diff --git a/args.hxx b/args.hxx index 6993016..5aee038 100644 --- a/args.hxx +++ b/args.hxx @@ -849,6 +849,10 @@ namespace args */ void LongSeparator(const std::string &longseparator) { + if (longseparator.empty()) + { + throw std::runtime_error("longseparator can not be set to empty"); + } this->longseparator = longseparator; } @@ -1051,17 +1055,16 @@ namespace args std::ostringstream problem; problem << "Flag '" << arg << "' requires an argument but received none"; throw ParseError(problem.str().c_str()); + } + + if (allowSeparateLongArgument) + { + argbase->ParseArg(*it); } else { - if (allowSeparateLongArgument) - { - argbase->ParseArg(*it); - } else - { - std::ostringstream problem; - problem << "Flag '" << arg << "' was passed a separate argument, but these are disallowed"; - throw ParseError(problem.str().c_str()); - } + std::ostringstream problem; + problem << "Flag '" << arg << "' was passed a separate argument, but these are disallowed"; + throw ParseError(problem.str().c_str()); } } } else if (separator != argchunk.npos) @@ -1110,17 +1113,16 @@ namespace args std::ostringstream problem; problem << "Flag '" << *argit << "' requires an argument but received none"; throw ParseError(problem.str().c_str()); + } + + if (allowSeparateShortArgument) + { + argbase->ParseArg(*it); } else { - if (allowSeparateShortArgument) - { - argbase->ParseArg(*it); - } else - { - std::ostringstream problem; - problem << "Flag '" << *argit << "' was passed a separate argument, but these are disallowed"; - throw ParseError(problem.str().c_str()); - } + std::ostringstream problem; + problem << "Flag '" << *argit << "' was passed a separate argument, but these are disallowed"; + throw ParseError(problem.str().c_str()); } } // Because this argchunk is done regardless -- cgit v1.2.1