CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Data Fields | |
enum caps_arg_parameter_flag | flags |
const char * | keyword |
int | key |
int(* | cb )(const struct caps_arg_parser *parser, const char *value) |
const char * | arg |
const char * | doc |
Information about one parameter keyword
All of these information can be static/const.
A command line parameter is:
flags
hasn't the CAPS_PARAM_OPTIONAL bit setflags
has the CAPS_PARAM_OPTIONAL bit setA command line parameter's value is:
arg
member is NULLarg
member is set and its flags
hasn't the CAPS_VALUE_OPTIONAL bit setarg
member is set and its flags
has the CAPS_VALUE_OPTIONAL bit setThe keyword
member defines the long parameter keyword and is mandatory. The key
member defines a short argument key, like 'd' which results into -d
to be understood and is optional. key
is optional if it contains a non-printable character.
key
is printable is done with the isprint() function inside the library.The member cb
defines the callback if the keyword
or key
is found in the command line arguments. It is always called with the corresponding caps_arg_parser and a value (if one was present). The corresponding caps_arg_parser enables the callback function to have access to its object
member for user defined run-time data.
Both the arg
and doc
members are used to create the help text. If you want to make use of NLS, don't forget to include these texts into the pot file.
enum caps_arg_parameter_flag flags |
Parameter and value description flags
const char* keyword |
Parameter long keyword name, like 'verbose', in conjunction with the key member
int key |
Parameter short key char, like 'v', in conjunction with the keyword member
int(* cb) (const struct caps_arg_parser *parser, const char *value) |
const char* arg |
Parameter value name (for the help text).
const char* doc |
Parameter description (help text).