Customization points for overriding default behaviors.
Define the following macros before including args.h to override default implementations. You can also use these in your own code for consistency.
Help Formatting | |
| #define | ARGS_STR_PREPAD (2) |
| Pre-padding for help text. | |
| #define | ARGS_PARAM_OFFSET (1) |
| Offset between argument and parameter in help text. | |
| #define | ARGS_HELP_OFFSET (4) |
| Offset from longest argument for help text. | |
| #define | ARGS_PRINT_H |
| Allow using print.h functions for args_pe, args_pd, args_pi and args_abort. | |
| #define | args_po(...) |
| Normal print. | |
Error Handling | |
| #define | args_pe(...) |
| Error print. | |
| #define | args_pd(...) |
| Developer-only debug print. | |
| #define | args_pi(arg) |
| Internal error print, user-facing dev print. | |
| #define | args_abort() |
| Abort function. | |
| #define | ARGS_IMPLICIT_SETS (64) |
| Maximum implicit allocations of argument::set booleans. | |
Functions | |
| void | args_help_print (const char *usage, const char *bin, const char *hint, const char *req, const char *opt) |
| Prints generated CLI help output. | |
Variables | |
| struct args_raw | argr |
Global storage of raw argc/. | |
| #define ARGS_STR_PREPAD (2) |
Pre-padding for help text.
| #define ARGS_PARAM_OFFSET (1) |
Offset between argument and parameter in help text.
| #define ARGS_HELP_OFFSET (4) |
Offset from longest argument for help text.
| #define ARGS_PRINT_H |
Allow using print.h functions for args_pe, args_pd, args_pi and args_abort.
| #define args_po | ( | ... | ) |
| #define args_pe | ( | ... | ) |
| #define args_pd | ( | ... | ) |
Developer-only debug print.
| #define args_pi | ( | arg | ) |
| #define args_abort | ( | ) |
| #define ARGS_IMPLICIT_SETS (64) |
Maximum implicit allocations of argument::set booleans.
| void args_help_print | ( | const char * | usage, |
| const char * | bin, | ||
| const char * | hint, | ||
| const char * | req, | ||
| const char * | opt ) |
Prints generated CLI help output.
Create your own help parse callback and call this function from it so you can provide custom usage, hint, req, and opt strings.
Example:
Outputs: "{usage}{bin}{hint}{req}<required args>\n{opt}<optional args>\n"