A class for collecting command line information. The class object will function somewhat like a namelist in that it gets loaded with keywords and can return the help messages for its contents upon receiving such a directive, but unlike namelists this one object is designed to be reconfigured for specific programs (even test programs, when it appears nested within the TestEnvironment class).
More...
|
std::string | getInputAsString (int width=0) const |
| Return the command line text as a string.
|
|
bool | doesProgramExitOnHelp () const |
| Obtain a verdict on whether the program is to exit after displaying a help message. This does not affect the setting within the object, but instead reports what the setting is.
|
|
void | activateHelpOnNoArgs () |
| Activate the printout of help messages if no command line arguments are provided.
|
|
void | suppressHelpOnNoArgs () |
| Suppress the printout of help messages if no command line arguments are provided.
|
|
void | activateExitOnHelp () |
| Order the program to exit after displaying general help documentation, with a return value of zero.
|
|
void | preventExitOnHelp () |
| Prevent the program from exiting after displaying general help documentation, with a return value of zero.
|
|
void | parseUserInput (int argc, const char *argv[]) |
| Supply the internal namelist with command-line input as if parsing from an input file.
|
|
void | coordinateWithPartner (CommandLineParser *other) |
| The nature of the command line parser as a unique sort of namelist which can be assembled and recombined from parts also suggests a utility in making multiple CommandLineParser objects in different parts of a program, which might all look at the same command line inputs but take in different information. In order for this to work, each object must be able to know that some other object will handle certain inputs, which should then not trigger warnings or errors.
|
|
void | addControlBlocks (const std::vector< std::string > &list) |
| Add a list of relevant namelists that will be displayed in the context of any help message. Arguments to the command line corresponding to each namelist, if recognized, will be passed down to trigger a display of the namelist's own documentation.
|
|
void | addCustomNamelists (const std::vector< NamelistToken > &custom_namelists_in) |
| Add a series of custom namelists to the object's repertoire of control blocks, about which it is prepared to dispense user information.
|
|
|
| CommandLineParser (const std::string &program_name_in, const std::string &program_description, const std::vector< std::string > ¬ed_imports_in={}, ExceptionResponse policy_in=ExceptionResponse::WARN) |
| The constructor is passed the list of command-line arguments. The object will take the first string in the list as the name of the calling program itself.
|
|
| CommandLineParser (const std::string &program_name_in, const std::string &program_description, ExceptionResponse policy_in) |
|
|
| CommandLineParser (const CommandLineParser &original)=default |
| With no pointers to repair and all members coming from or built using Standard Template Library objects, the default copy and move constructors, as well as copy and move assignment operators, are valid.
|
|
| CommandLineParser (CommandLineParser &&original)=default |
|
CommandLineParser & | operator= (const CommandLineParser &original)=default |
|
CommandLineParser & | operator= (CommandLineParser &&original)=default |
|
|
void | addStandardAmberInputs (const std::vector< std::string > &cli_keys) |
| Impart the typical comand-line keywords inspired by Amber.
|
|
void | addStandardAmberInputs (const char *key_a, const char *key_b=nullptr, const char *key_c=nullptr, const char *key_d=nullptr) |
|
void | addStandardAmberInputs () |
|
|
void | addStandardBenchmarkingInputs (const std::vector< std::string > &cli_keys) |
| Impart some common benchmarking keywords to the command line interface. Overloading and descriptions of input parameters follow from addStandardAmberInputs(), above.
|
|
void | addStandardBenchmarkingInputs (const char *key_a, const char *key_b=nullptr, const char *key_c=nullptr, const char *key_d=nullptr) |
|
void | addStandardBenchmarkingInputs () |
|
|
void | addStandardApplicationInputs (const std::vector< std::string > &cli_keys) |
| Impart some common application command line arguments to the interface. Overloading and descriptions of input parameters follow from addStandardAmberInputs(), above.
|
|
void | addStandardApplicationInputs (const char *key_a, const char *key_b=nullptr, const char *key_c=nullptr, const char *key_d=nullptr) |
|
void | addStandardApplicationInputs () |
|
|
const NamelistEmulator * | getNamelistPointer () const |
| Return a pointer to the internal namelist.
|
|
NamelistEmulator * | getNamelistPointer () |
|
A class for collecting command line information. The class object will function somewhat like a namelist in that it gets loaded with keywords and can return the help messages for its contents upon receiving such a directive, but unlike namelists this one object is designed to be reconfigured for specific programs (even test programs, when it appears nested within the TestEnvironment class).