From 7f52eda048fa5d6a122afa351a3052f2c36b1dce Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 21 Mar 2011 12:36:21 +0000 Subject: [PATCH] extracted showHelp() function --- catch_runner.hpp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/catch_runner.hpp b/catch_runner.hpp index 40f7456b..3d5bf7d1 100644 --- a/catch_runner.hpp +++ b/catch_runner.hpp @@ -80,6 +80,28 @@ namespace Catch } return static_cast( runner.getFailureCount() ); } + + ////////////////////////////////////////////////////////////////////////// + void showHelp + ( + std::string exeName + ) + { + std::string::size_type pos = exeName.find_last_of( "/\\" ); + if( pos != std::string::npos ) + { + exeName = exeName.substr( pos+1 ); + } + + std::cout << exeName << " is a CATCH host application. Options are as follows:\n\n" + << "\t-l, --list [xml]\n" + << "\t-t, --test [...]\n" + << "\t-r, --reporter \n" + << "\t-o, --out |<%stream name>\n" + << "\t-s, --success\n" + << "\t-b, --break\n\n" + << "For more detail usage please see: https://github.com/philsquared/Catch/wiki/Command-line" << std::endl; + } ////////////////////////////////////////////////////////////////////////// inline int Main @@ -100,21 +122,7 @@ namespace Catch // Handle help if( config.showHelp() ) { - std::string exeName( argv[0] ); - std::string::size_type pos = exeName.find_last_of( "/\\" ); - if( pos != std::string::npos ) - { - exeName = exeName.substr( pos+1 ); - } - - std::cout << exeName << " is a CATCH host application. Options are as follows:\n\n" - << "\t-l, --list [xml]\n" - << "\t-t, --test [...]\n" - << "\t-r, --reporter \n" - << "\t-o, --out |<%stream name>\n" - << "\t-s, --success\n" - << "\t-b, --break\n\n" - << "For more detail usage please see: https://github.com/philsquared/Catch/wiki/Command-line" << std::endl; + showHelp( argv[0] ); return 0; }