ProgramArg struct

One flag, option, or positional argument.

The schema is not allocated. Value pointers passed in must outlive parsing. possible is a NULL-terminated list. conflicts and requires name another argument id. short_name 0 and a NULL long_name omit that form.

Public variables

const char* id
Name used by getters and by conflicts and requires.
char short_name
Short-option character, without '-'.
const char* long_name
Long-option name, without dashes.
const char* help
Help text.
const char* value_name
Placeholder name in help.
const char* default_value
Default text.
const char*const * possible
NULL-terminated exact values.
const char* conflicts
Conflicting argument id, or NULL.
const char*ArgAction action
Required companion argument id, or NULL.
ArgValueKind kind
Type a value must parse as before it is stored.
bool required
When true, an omitted argument fails unless default_value was stored.
bool positional
True when this is a positional argument.

Variable documentation

char ProgramArg::short_name

Short-option character, without '-'.

0 omits it. Ignored when positional.

const char* ProgramArg::long_name

Long-option name, without dashes.

NULL omits it.

const char* ProgramArg::help

Help text.

NULL prints a blank description.

const char* ProgramArg::value_name

Placeholder name in help.

NULL uses id.

const char* ProgramArg::default_value

Default text.

NULL if none.

const char*const * ProgramArg::possible

NULL-terminated exact values.

NULL skips this check. Not copied.

const char*ArgAction ProgramArg::action

Required companion argument id, or NULL.

What happens when this argument appears.