mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-10 04:41:57 -04:00
now throws exception on matching names/flags/desc
This commit is contained in:
parent
b7a7649bbf
commit
4aa7c869ff
@ -96,17 +96,14 @@ void CmdLine::add( Arg& a )
|
|||||||
|
|
||||||
void CmdLine::add( Arg* a )
|
void CmdLine::add( Arg* a )
|
||||||
{
|
{
|
||||||
if ( find(_argList.begin(),_argList.end(), a) != _argList.end() )
|
for( ArgIterator iter = _argList.begin(); iter != _argList.end(); iter++ )
|
||||||
{
|
if ( *a == *(*iter) )
|
||||||
cerr << "ADD ERROR: Argument with same flag/name already exists: "
|
throw( ArgException( "Argument with same flag/name already exists!",
|
||||||
<< a->toString() << " Ignoring!" << endl;
|
a->longID() ) );
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
a->addToList( _argList );
|
a->addToList( _argList );
|
||||||
|
|
||||||
if ( a->isRequired() ) _numRequired++;
|
if ( a->isRequired() ) _numRequired++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmdLine::version(int exitVal)
|
void CmdLine::version(int exitVal)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user