Tools for parsing command line arguments.
More...
|
|
#define | MAUG_CLI_SIGIL_SZ 1 |
| |
|
#define | MAUG_CLI_SIGIL "-" |
| | Default flag to prepend to CLI arguments. Is "/" on Windows/DOS and "-" on other platforms. Can be overridden with a -D flag or define.
|
| |
|
#define | MAUG_CLI_ARG_C_DEFAULT -1 |
| |
|
#define | MAUG_CLI_ARG_HELP_SZ_MAX 127 |
| |
|
#define | MAUG_CLI_ARG_SZ_MAX 20 |
| |
|
#define | MAUG_CLI_TRACE_LVL 0 |
| |
|
|
typedef MERROR_RETVAL(* | maug_cli_cb) (const char *arg, ssize_t arg_c, void *data) |
| |
|
|
MERROR_RETVAL | maug_cli_h (const char *arg, ssize_t arg_c, void *args) |
| |
|
MERROR_RETVAL | maug_parse_args (int argc, char *argv[]) |
| |
| MERROR_RETVAL | maug_add_arg (const char *arg, int arg_sz, const char *help, int help_sz, maug_cli_cb arg_cb, void *data) |
| | Add a command-line argument to the built-in parser. More...
|
| |
Tools for parsing command line arguments.
◆ maug_add_arg()
| MERROR_RETVAL maug_add_arg |
( |
const char * |
arg, |
|
|
int |
arg_sz, |
|
|
const char * |
help, |
|
|
int |
help_sz, |
|
|
maug_cli_cb |
arg_cb, |
|
|
void * |
data |
|
) |
| |
Add a command-line argument to the built-in parser.
- Parameters
-
| arg | String containing the argument to look for. |
| arg_sz | Length of arg in chars or 0 to autodetect. |
| help | Help text for the arg when -h is invoked. |
| help_sz | Length of help in chars or 0 to autodetect. |
| arg_cb | ::maug_cli_cb to invoke when arg is found. |