diff -r 4149af40c0e2 -r 074caa25365e tool/main.cpp --- a/tool/main.cpp Wed Jul 23 16:18:48 2008 +0000 +++ b/tool/main.cpp Thu Jul 24 07:40:45 2008 +0000 @@ -41,7 +41,7 @@ const char *briefDesc; int execute(void) const; - void displayHelp(void) const; + string getHelpString(void) const; }; /*****************************************************************************/ @@ -251,7 +251,7 @@ func(); } catch (InvalidUsageException &e) { cerr << e.what() << endl << endl; - displayHelp(); + cerr << getHelpString(); return 1; } catch (CommandException &e) { cerr << e.what() << endl; @@ -266,9 +266,11 @@ /****************************************************************************/ -void Command::displayHelp() const -{ - cerr << binaryBaseName << " " << commandName << " " << helpString; +string Command::getHelpString() const +{ + stringstream help; + help << binaryBaseName << " " << commandName << " " << helpString; + return help.str(); } /****************************************************************************/ @@ -342,7 +344,7 @@ masterDev.setIndex(masterIndex); retval = cmd->execute(); } else { - cmd->displayHelp(); + cout << cmd->getHelpString(); } } else { cerr << "Ambiguous command abbreviation! Matching:" << endl;