Minimac4
|
Extension of struct option
that includes a description string.
More...
#include <getopt_wrapper.hpp>
Public Member Functions | |
option_with_desc (const char *_name, int _has_arg, int *_flag, int _val, const char *_description) | |
Construct an option with description. | |
Public Attributes | |
const char * | description |
Description of the command-line option for help output. | |
Extension of struct option
that includes a description string.
This structure inherits from the standard GNU struct option
(used with getopt_long
) and adds an additional field for a human-readable description. It is useful for generating formatted help/usage messages alongside command-line parsing.
Each option includes:
name
: The long option name (e.g., "--input"
).has_arg
: Whether the option requires an argument (no_argument
, required_argument
, or optional_argument
).flag
: Pointer to an int variable that is set if the option is found, or nullptr
if the option’s value should be returned.val
: The short option character equivalent (e.g., ‘'i’). -
description`: A string describing the option, shown in help output.Example:
|
inline |
Construct an option with description.
_name | Long option name (without leading dashes). |
_has_arg | Argument requirement (no_argument, required_argument, optional_argument). |
_flag | Pointer to variable set if option is found, or nullptr. |
_val | Value returned (or short option character). |
_description | Human-readable description of the option. |
const char* getopt_wrapper::option_with_desc::description |
Description of the command-line option for help output.