summaryrefslogtreecommitdiff
path: root/src/til_args.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-10-03 17:15:09 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-10-03 17:24:24 -0700
commit9a98cfe6224757ad21c223f74efb537d9edca24f (patch)
treec2ccfe5d4d4b1a56c7f02af54bec88bb2a0fe87e /src/til_args.h
parentb686b405c6a22b26e9b8082c92ed91513608bea3 (diff)
args: move argument parsing/help output to libtil
This is totally opt-in for libtil callers, but is a step towards enabling uniform cli invocations across frontends. The help side of this is particularly janky, but since what's appropriate there is directly related to the args parsing it seems appropriate to bring along. The janky part is the implicit output formatting assumptions being made, as-is it doesn't really lend itself well to being augmented into broader frontend help output. Alas, this is rototiller playground, so let's just go easy and assume frontends will largely spit out whatever this provides - or completely replace it if appropriate.
Diffstat (limited to 'src/til_args.h')
-rw-r--r--src/til_args.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/til_args.h b/src/til_args.h
new file mode 100644
index 0000000..018ae80
--- /dev/null
+++ b/src/til_args.h
@@ -0,0 +1,17 @@
+#ifndef _TIL_ARGS_H
+#define _TIL_ARGS_H
+
+#include <stdio.h>
+
+typedef struct til_args_t {
+ const char *module;
+ const char *video;
+
+ unsigned use_defaults:1;
+ unsigned help:1;
+} til_args_t;
+
+int til_args_parse(int argc, const char *argv[], til_args_t *res_args);
+int til_args_help(FILE *out);
+
+#endif
© All Rights Reserved