Refactored command line parsers into polymorphic classes

This commit is contained in:
Phil Nash 2012-08-25 21:26:05 +01:00
parent 95ae50ad3d
commit eb775aa7af
3 changed files with 325 additions and 103 deletions

View file

@ -173,7 +173,9 @@ namespace Catch {
try {
CommandParser parser( argc, argv );
AllOptions options;
if( Command cmd = parser.find( "-h", "-?", "--help" ) ) {
if( cmd.argsCount() != 0 )
cmd.raiseError( "Does not accept arguments" );
@ -183,7 +185,7 @@ namespace Catch {
return 0;
}
parseIntoConfig( parser, config.data() );
options.parseIntoConfig( parser, config.data() );
}
catch( std::exception& ex ) {
std::cerr << ex.what() << "\n\nUsage: ...\n\n";