| 6307 | } |
| 6308 | |
| 6309 | int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { |
| 6310 | try { |
| 6311 | m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail ); |
| 6312 | m_unusedTokens = m_cli.parseInto( argc, argv, m_configData ); |
| 6313 | if( m_configData.showHelp ) |
| 6314 | showHelp( m_configData.processName ); |
| 6315 | m_config.reset(); |
| 6316 | } |
| 6317 | catch( std::exception& ex ) { |
| 6318 | { |
| 6319 | Colour colourGuard( Colour::Red ); |
| 6320 | Catch::cerr() |
| 6321 | << "\nError(s) in input:\n" |
| 6322 | << Text( ex.what(), TextAttributes().setIndent(2) ) |
| 6323 | << "\n\n"; |
| 6324 | } |
| 6325 | m_cli.usage( Catch::cout(), m_configData.processName ); |
| 6326 | return (std::numeric_limits<int>::max)(); |
| 6327 | } |
| 6328 | return 0; |
| 6329 | } |
| 6330 | |
| 6331 | void useConfigData( ConfigData const& _configData ) { |
| 6332 | m_configData = _configData; |