summaryrefslogtreecommitdiff
path: root/src/options
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-06-14 00:05:58 -0500
committersanine <sanine.not@pm.me>2022-06-14 00:05:58 -0500
commit034d5c965ff34cfdf4b153af9f32360a02e35684 (patch)
treefcbe5ca527d76a303c197ea8308c6e488ef7c0b4 /src/options
parent8fb7916a0d0cb007a4c3a4e6a31af58765268ca3 (diff)
scorched earth, start over
Diffstat (limited to 'src/options')
-rw-r--r--src/options/honey_options.c55
-rw-r--r--src/options/honey_options.h14
2 files changed, 0 insertions, 69 deletions
diff --git a/src/options/honey_options.c b/src/options/honey_options.c
deleted file mode 100644
index cf93588..0000000
--- a/src/options/honey_options.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdio.h>
-#include <unistd.h> /* todo: create windows-compatible alternative */
-
-#include "options/honey_options.h"
-
-
-static void print_usage(const char *program_name)
-{
- printf("Usage: %s [OPTIONS]\n"
- " -v Increase output verbosity (-vvv displays every log message)\n"
- " -q Decrease output verbosity (-qqq suppresses even fatal errors)\n"
- " -h Print this help message and exit\n"
- " -s SCRIPT Load SCRIPT as the entry point instead of 'main.lua'\n",
- program_name);
-}
-
-
-int parse_options(struct honey_options *opts, int argc, char **argv)
-{
- opts->main_script = "main.lua";
- opts->log_level = WARN;
- opts->display_help = 0;
-
- int opt;
- const char *flags = "hqvs:";
- while ((opt = getopt(argc, argv, flags)) != -1) {
- switch (opt) {
- case 'q':
- opts->log_level -= 1;
- break;
-
- case 'v':
- opts->log_level += 1;
- break;
-
- case 'h':
- print_usage(argv[0]);
- opts->display_help = 1;
- return 1;
-
- case 's':
- opts->main_script = optarg;
- break;
-
- default:
- print_usage(argv[0]);
- return 0;
- }
- }
-
- honey_log_set_level(opts->log_level);
- honey_log_set_file(stderr);
-
- return 1;
-}
diff --git a/src/options/honey_options.h b/src/options/honey_options.h
deleted file mode 100644
index 5f4aded..0000000
--- a/src/options/honey_options.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef HONEY_OPTIONS_H
-#define HONEY_OPTIONS_H
-
-#include "logging/logging.h"
-
-struct honey_options {
- const char *main_script;
- enum honey_log_level_t log_level;
- int display_help;
-};
-
-int parse_options(struct honey_options *opts, int argc, char **argv);
-
-#endif