37 os <<
"Reg: " << prog.
m_name <<
": \t" << prog.
m_desc << std::endl;
50 catch(
const std::out_of_range& )
61 os <<
"Run a utility tool." << std::endl;
63 os <<
"Usage: " <<
name <<
" [-h] [-l] [TOOL [TOOL_OPTIONS]]" << std::endl;
65 os <<
" -h show this message and exit." << std::endl
66 <<
" -l print known tools and exit." << std::endl;
69 os <<
"Known tools: " << std::endl;
77 wxMessageOutput::Set(
new wxMessageOutputStderr );
86 const std::string arg1( argv[1] );
95 else if( arg1 ==
"-l" )
110 return ( *func )( argc - 1, argv + 1 );
UTILITY_PROGRAM::FUNC * findSubUtility(const std::string &aName) const
Find a sub-utility with the given ID/name.
void showSubUtilityList(std::ostream &os) const
Format the list of known sub-utils.
void printUsage(char *name, std::ostream &os) const
Print the command line usage of this program.
int HandleCommandLine(int argc, char **argv) const
Take in a command line and:
static PLUGIN_MAP & GetInfoMap()
Accessor for the static registry map.
@ UNKNOWN_TOOL
The tool asked for was not found.
@ BAD_CMDLINE
The command line was not correct for the tool.
Description of a "utility program", which is a program that takes some command line and does "somethi...
std::function< int(int argc, char **argv)> FUNC
A function that provides the program for a given command line.
std::string m_name
The name of the program (this is used to select one)
FUNC m_func
The function to call to run the program.
std::string m_desc
Description of the program.