|
libfossil
|
Models a single CLI flag. More...
#include "cli.h"
Data Fields | |
| fcli_flag_callback_f | callback |
| Optional callback which gets passed the flag, if it is set, after fcli has assigned the flagValue entry (if it is not NULL). | |
| const char * | flagLong |
| "Long-form" for this flag, noting that there's no restriction on its length. | |
| const char * | flagShort |
| "Short-form" for this flag, noting that there's no restriction on its length. | |
| enum fcli_cliflag_type_e | flagType |
| Specifies how to interpret the data pointed to by this->flagValue. | |
| void * | flagValue |
| If not NULL, the member is the target of the flag's value. | |
| const char * | flagValueLabel |
| Optional descriptive label to be used when rendering help text: | |
| const char * | helpText |
| Help text for the flag. | |
Models a single CLI flag.
Its relative complexity is largely to support generation of help text.
| fcli_flag_callback_f fcli_cliflag::callback |
| const char* fcli_cliflag::flagLong |
| const char* fcli_cliflag::flagShort |
| enum fcli_cliflag_type_e fcli_cliflag::flagType |
| void* fcli_cliflag::flagValue |
If not NULL, the member is the target of the flag's value.
Its exact interpretation depends on the value of this->flagType:
If this member is not NULL: If the flag is set, this value will be assigned to. If the flag is not set in the CLI args, this value is not written to.
If this member is NULL then fcli_process_flags() will simply skip over it, but the help-text generator will process it. This can be used to set up flags which will appear in the –help text but which are processed separately (or outright ignored) by the app.
The underlying flag value's string memory is owned by fcli and is valid until the app exits.
| const char* fcli_cliflag::flagValueLabel |
Optional descriptive label to be used when rendering help text:
-x|–x-flag=ABCD
If it is NULL, the –help text generator will choose a value of the ABCD part which depends on this->flagType.
This is only used if this->flagType is not one of (FCLI_FLAG_TYPE_BOOL, FCLI_FLAG_TYPE_BOOL_INVERT). For those types (which have no client-given values), this member is ignored when generating help text.
| const char* fcli_cliflag::helpText |