aboutsummaryrefslogtreecommitdiff
path: root/src/cli/stasis_indexer/args.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2024-12-07 19:53:44 -0500
committerGitHub <noreply@github.com>2024-12-07 19:53:44 -0500
commit456c5a481a7dabb53434a696488ac6eecb962d5b (patch)
tree8f4743a4cfdad61f9aeac0dffce050e5bd9eef1d /src/cli/stasis_indexer/args.c
parentbdadebfceffad22179b33948113b2bf82f02c1f7 (diff)
parent4c403d1f1318a163b017605c2af6d1a14c579f99 (diff)
downloadstasis-456c5a481a7dabb53434a696488ac6eecb962d5b.tar.gz
Merge pull request #74 from jhunkeler/with-indexer-tlc
Combined: indexer-tlc and clone-existing-directory
Diffstat (limited to 'src/cli/stasis_indexer/args.c')
-rw-r--r--src/cli/stasis_indexer/args.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cli/stasis_indexer/args.c b/src/cli/stasis_indexer/args.c
new file mode 100644
index 0000000..2d92ab0
--- /dev/null
+++ b/src/cli/stasis_indexer/args.c
@@ -0,0 +1,38 @@
+#include "core.h"
+#include "args.h"
+
+struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"destdir", required_argument, 0, 'd'},
+ {"verbose", no_argument, 0, 'v'},
+ {"unbuffered", no_argument, 0, 'U'},
+ {"web", no_argument, 0, 'w'},
+ {0, 0, 0, 0},
+};
+
+const char *long_options_help[] = {
+ "Display this usage statement",
+ "Destination directory",
+ "Increase output verbosity",
+ "Disable line buffering",
+ "Generate HTML indexes (requires pandoc)",
+ NULL,
+};
+
+void usage(char *name) {
+ const int maxopts = sizeof(long_options) / sizeof(long_options[0]);
+ char *opts = calloc(maxopts + 1, sizeof(char));
+ for (int i = 0; i < maxopts; i++) {
+ opts[i] = (char) long_options[i].val;
+ }
+ printf("usage: %s [-%s] {{STASIS_ROOT}...}\n", name, opts);
+ guard_free(opts);
+
+ for (int i = 0; i < maxopts - 1; i++) {
+ char line[255] = {0};
+ sprintf(line, " --%s -%c %-20s", long_options[i].name, long_options[i].val, long_options_help[i]);
+ puts(line);
+ }
+
+}
+