aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Doxyfile2
-rw-r--r--args.hxx38
2 files changed, 21 insertions, 19 deletions
diff --git a/Doxyfile b/Doxyfile
index 9fe6504..489417f 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME = "args"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 2.0.0
+PROJECT_NUMBER = 2.1.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
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