Add parse_func
This commit is contained in:
9
main.c
9
main.c
@@ -1,8 +1,11 @@
|
||||
#include "argparser.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void parse_func(arg_t arg, void *user_data);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
argparser_t *parser = create_parser();
|
||||
argparser_t *parser = create_parser(parse_func);
|
||||
|
||||
add_argument(parser, (arg_t){ARG_TYPE_POSITIONAL, "c", "count"});
|
||||
add_argument(parser, (arg_t){ARG_TYPE_POSITIONAL, "g", "group"});
|
||||
@@ -12,9 +15,11 @@ int main(int argc, char *argv[]) {
|
||||
add_argument(parser, (arg_t){ARG_TYPE_FLAG, "u", "undo"});
|
||||
add_argument(parser, (arg_t){ARG_TYPE_FLAG, "d", "delete"});
|
||||
|
||||
print_usage(parser);
|
||||
parse_args(parser, argc, argv);
|
||||
|
||||
destroy_parser(&parser);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void parse_func(arg_t arg, void *user_data) {}
|
||||
|
||||
Reference in New Issue
Block a user