2 #include "command-line-arguments.h"
6 main (int argc, char **argv)
15 const char *pos_arg1 = NULL;
16 const char *pos_arg2 = NULL;
17 const char *string_val = NULL;
18 bool bool_val = false;
19 bool fl_set = false, int_set = false, bool_set = false, kwb_set = false,
20 kw_set = false, string_set = false, pos1_set = false, pos2_set = false;
22 notmuch_opt_desc_t parent_options[] = {
23 { .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords =
24 (notmuch_keyword_t []){ { "one", 1 << 0 },
28 { .opt_int = &int_val, .name = "int", .present = &int_set },
32 notmuch_opt_desc_t options[] = {
33 { .opt_bool = &bool_val, .name = "boolean", .present = &bool_set },
34 { .opt_keyword = &kw_val, .name = "keyword", .present = &kw_set, .keywords =
35 (notmuch_keyword_t []){ { "zero", 0 },
39 { .opt_keyword = &kwb_val, .name = "boolkeyword", .present = &kwb_set,
40 .keyword_no_arg_value = "true", .keywords =
41 (notmuch_keyword_t []){ { "false", 0 },
45 { .opt_inherit = parent_options },
46 { .opt_string = &string_val, .name = "string", .present = &string_set },
47 { .opt_position = &pos_arg1, .present = &pos1_set },
48 { .opt_position = &pos_arg2, .present = &pos2_set },
52 opt_index = parse_arguments (argc, argv, options, 1);
58 printf ("boolean %d\n", bool_val);
61 printf ("keyword %d\n", kw_val);
64 printf ("boolkeyword %d\n", kwb_val);
67 printf ("flags %d\n", fl_val);
70 printf ("int %d\n", int_val);
73 printf ("string %s\n", string_val);
76 printf ("positional arg 1 %s\n", pos_arg1);
79 printf ("positional arg 2 %s\n", pos_arg2);
82 for (; opt_index < argc; opt_index++) {
83 printf ("non parsed arg %d = %s\n", opt_index, argv[opt_index]);