MCPcopy Create free account
hub / github.com/catchorg/Catch2 / applyCommandLine

Method applyCommandLine

extras/catch_amalgamated.cpp:1409–1436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1407 }
1408
1409 int Session::applyCommandLine( int argc, char const * const * argv ) {
1410 if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }
1411
1412 auto result = m_cli.parse( Clara::Args( argc, argv ) );
1413
1414 if( !result ) {
1415 config();
1416 getCurrentMutableContext().setConfig(m_config.get());
1417 auto errStream = makeStream( "%stderr" );
1418 auto colour = makeColourImpl( ColourMode::PlatformDefault, errStream.get() );
1419
1420 errStream->stream()
1421 << colour->guardColour( Colour::Red )
1422 << "\nError(s) in input:\n"
1423 << TextFlow::Column( result.errorMessage() ).indent( 2 )
1424 << "\n\n";
1425 errStream->stream() << "Run with -? for usage\n\n" << std::flush;
1426 return UnspecifiedErrorExitCode;
1427 }
1428
1429 if( m_configData.showHelp )
1430 showHelp();
1431 if( m_configData.libIdentify )
1432 libIdentify();
1433
1434 m_config.reset();
1435 return 0;
1436 }
1437
1438#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
1439 int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {

Callers 1

mainFunction · 0.45

Calls 11

ArgsClass · 0.70
makeStreamFunction · 0.70
makeColourImplFunction · 0.70
ColumnClass · 0.70
parseMethod · 0.45
setConfigMethod · 0.45
getMethod · 0.45
guardColourMethod · 0.45
indentMethod · 0.45
errorMessageMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected