ProgramCmd struct

A command and its direct subcommands.

subs points at an array of the same struct, so nesting is recursive. –help is recognized automatically. –version is recognized when version is not NULL, unless the command already defines those names.

Public variables

const char* name
Command name in usage and as a subcommand token.
const char* about
Help description.
const char* version
Version text.
const ProgramArg* args
Caller-owned arguments.
size_t n_args
Number of elements in args.
const struct ProgramCmd* subs
Caller-owned direct subcommands.
size_t n_subs
Number of elements in subs.

Variable documentation

const char* ProgramCmd::about

Help description.

NULL or empty omits the paragraph under the usage line.

const char* ProgramCmd::version

Version text.

NULL disables –version.

const ProgramArg* ProgramCmd::args

Caller-owned arguments.

Not copied. NULL when n_args is 0.

const struct ProgramCmd* ProgramCmd::subs

Caller-owned direct subcommands.

Not copied. NULL when n_subs is 0.