mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-10 12:49:08 -04:00
make error message a bit more meaningful
This commit is contained in:
parent
ab82cc7f87
commit
b8b1bb2467
@ -197,7 +197,15 @@ inline bool SwitchArg::processArg(int *i, std::vector<std::string>& args)
|
|||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
if ( _alreadySet || ( !ret && combinedSwitchesMatch( args[*i] ) ) )
|
if ( _alreadySet || ( !ret && combinedSwitchesMatch( args[*i] ) ) )
|
||||||
throw(CmdLineParseException("Argument already set!", toString()));
|
{
|
||||||
|
if ( _xorSet )
|
||||||
|
throw(CmdLineParseException(
|
||||||
|
"Mutually exclusive argument already set!",
|
||||||
|
toString()));
|
||||||
|
else
|
||||||
|
throw(CmdLineParseException("Argument already set!",
|
||||||
|
toString()));
|
||||||
|
}
|
||||||
|
|
||||||
_alreadySet = true;
|
_alreadySet = true;
|
||||||
|
|
||||||
|
@ -335,7 +335,15 @@ bool ValueArg<T>::processArg(int *i, std::vector<std::string>& args)
|
|||||||
if ( argMatches( flag ) )
|
if ( argMatches( flag ) )
|
||||||
{
|
{
|
||||||
if ( _alreadySet )
|
if ( _alreadySet )
|
||||||
throw( CmdLineParseException("Argument already set!", toString()) );
|
{
|
||||||
|
if ( _xorSet )
|
||||||
|
throw( CmdLineParseException(
|
||||||
|
"Mutually exclusive argument already set!",
|
||||||
|
toString()) );
|
||||||
|
else
|
||||||
|
throw( CmdLineParseException("Argument already set!",
|
||||||
|
toString()) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( Arg::delimiter() != ' ' && value == "" )
|
if ( Arg::delimiter() != ' ' && value == "" )
|
||||||
throw( ArgParseException(
|
throw( ArgParseException(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
PARSE ERROR: Argument: -b (--bbb)
|
PARSE ERROR: Argument: -b (--bbb)
|
||||||
Argument already set!
|
Mutually exclusive argument already set!
|
||||||
|
|
||||||
Brief USAGE:
|
Brief USAGE:
|
||||||
../examples/test5 {-a <string>|-b <string>} {--eee <string>|--fff
|
../examples/test5 {-a <string>|-b <string>} {--eee <string>|--fff
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
PARSE ERROR: Argument: -b (--bbb)
|
PARSE ERROR: Argument: -b (--bbb)
|
||||||
Argument already set!
|
Mutually exclusive argument already set!
|
||||||
|
|
||||||
Brief USAGE:
|
Brief USAGE:
|
||||||
../examples/test5 {-a <string>|-b <string>} {--eee <string>|--fff
|
../examples/test5 {-a <string>|-b <string>} {--eee <string>|--fff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user