diff options
author | sanine <sanine.not@pm.me> | 2022-01-04 23:18:10 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-01-04 23:18:10 -0600 |
commit | 78ee0de29b46f5faed6ca2ae5222c64fbd9a2c1e (patch) | |
tree | 02122654d8b360471760b8e4809151ca6c60c02a /src/options.c | |
parent | 72e13dff9ff4fde91b84054167da91a5d27cb952 (diff) |
allow overriding the builtin script
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/options.c b/src/options.c index cab8079..fa6b999 100644 --- a/src/options.c +++ b/src/options.c @@ -6,10 +6,11 @@ static void print_usage(const char *progname) { - printf("Usage: %s [-c config_file] [-v[v[v]]] [-q[q[q]]] [-h]\n" + printf("Usage: %s [-c config_file] [-v[v[v]]] [-q[q[q]]] [-h] [-s script]\n" " -v Increase output verbosity (-vvv displays every log message)\n" " -q Decrease output verbosity (-qqq suppresses even fatal errors)\n" " -c Specify configuration file to read (default 'config.lua')\n" + " -s Override the built-in Lua script\n" " -h Print this help message and exit\n", progname); } @@ -18,9 +19,10 @@ int parse_options(struct argent_options *opts, int argc, char **argv) { opts->log_level = WARN; opts->conf_filename = "config.lua"; + opts->script_filename = NULL; int opt; - while ((opt = getopt(argc, argv, "hqvc:")) != -1) { + while ((opt = getopt(argc, argv, "hqvc:s:")) != -1) { switch (opt) { case 'q': opts->log_level -= 1; @@ -34,6 +36,10 @@ int parse_options(struct argent_options *opts, int argc, char **argv) opts->conf_filename = optarg; break; + case 's': + opts->script_filename = optarg; + break; + case 'h': print_usage(argv[0]); return 2; |