code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(22 lines)
1 // Command line argument parsing
3 #pragma once
5 #include <stdbool.h>
7 #include "datatypes.h"
8 #include "types.h"
10 typedef struct {
11 const char *name;
12 void *dest;
13 const TypeInfo_t *type;
14 char short_flag;
15 bool required, populated;
16 } cli_arg_t;
18 void tomo_parse_args(int argc, char *argv[], Text_t usage, Text_t help, const char *version, int spec_len,
19 cli_arg_t spec[spec_len]);
21 bool pop_cli_flag(List_t *args, char short_flag, const char *flag, void *dest, const TypeInfo_t *type);
22 bool pop_cli_positional(List_t *args, const char *flag, void *dest, const TypeInfo_t *type, bool allow_dashes);