CAPS Universe documentation  1.0.4
All you need to know to be successful
Data Fields

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
 

Detailed Description

Information about one parameter keyword

static int verbosity = 0;
static int cb_verbose(const struct caps_arg_parser *parser, const char *value)
{
verbosity++;
return 0;
}
static const struct caps_arg_parameter some_option = {
.keyword = "verbose", .key = 'v',
.cb = cb_verbose,
.arg = NULL, .doc = NLS_("Increase verbosity"),
};
static const struct caps_arg_parser parser
Definition: capsinfo.c:139
static int cb_verbose(const struct caps_arg_parser *parser, const char *value)
Definition: capsinfo.c:128
@ CAPS_PARAM_OPTIONAL
Definition: libcapscmdparser.h:273
#define NLS_(string)
National Language Support related.
Definition: libcapsbase-local.h:61
Definition: libcapscmdparser.h:325
enum caps_arg_parameter_flag flags
Definition: libcapscmdparser.h:326
Definition: libcapscmdparser.h:348

All of these information can be static/const.

A command line parameter is:

A command line parameter's value is:

The 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.

Note
The check if 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.

Field Documentation

◆ flags

Parameter and value description flags

◆ keyword

const char* keyword

Parameter long keyword name, like 'verbose', in conjunction with the key member

◆ key

int key

Parameter short key char, like 'v', in conjunction with the keyword member

◆ cb

int(* cb) (const struct caps_arg_parser *parser, const char *value)

◆ arg

const char* arg

Parameter value name (for the help text).

Note
Mark for NLS

◆ doc

const char* doc

Parameter description (help text).

Note
Mark for NLS

The documentation for this struct was generated from the following file: