Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
Class for parsing and handling options passed as command line arguments. More...
#include <posix/app/chilictl/common/Args.hpp>
Public Member Functions | |
Args () | |
Default constructor, initialises empty arg parser. More... | |
ca_error | ProcessOption (int &argi, int argc, const char *argv[]) |
Process a single option from argv using the provided ArgOpt structures. More... | |
void | PrintOptionHelpStrings (FILE *aOutFile) |
Print all of the option help strings to the 'out' file pointer in manpage format. More... | |
void | AddOption (ArgOpt &aOption) |
Add an option definition to this parser. More... | |
Class for parsing and handling options passed as command line arguments.
Conforms to POSIX, also supports GNU style long options.
|
inline |
Default constructor, initialises empty arg parser.
|
inline |
void ca::Args::PrintOptionHelpStrings | ( | FILE * | aOutFile | ) |
Print all of the option help strings to the 'out' file pointer in manpage format.
aOutFile | FILE to print to. |
ca_error ca::Args::ProcessOption | ( | int & | argi, |
int | argc, | ||
const char * | argv[] | ||
) |
Process a single option from argv using the provided ArgOpt structures.
This function increments argi internally, and in the case where an option takes an argument, it may increment it more than once. If the end of options has been reached, or a non-option argument in encountered, CA_ERROR_NOT_HANDLED will be returned.
argi should begin at 1 to avoid processing the arg0, which is the executable name.
argi | Current index to process in argv. argi will be increased if processing is successful. |
argc | Argument count (number of args in argv) |
argv | Argument vector (Array of c-strings, representing the arguments) |
CA_ERROR_SUCCESS | Successfully processed options |
CA_ERROR_NOT_HANDLED | Positional argument encountered or end of arguments reached |
CA_ERROR_INVALID_ARGS | Option not recognised or incorrect usage |