summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-01-04 15:05:41 -0600
committersanine <sanine.not@pm.me>2022-01-04 15:05:41 -0600
commitcc82d13a4f80a5a2483581dd679f06772a9e3a19 (patch)
tree6cb096ade3e7db59cc91cd836d6e7de95a01cec4 /src/options.c
parenta026db7389c15eb5a8905e6f04eb3a92bf31f9bc (diff)
add layout loading
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/options.c b/src/options.c
index d221828..e694f99 100644
--- a/src/options.c
+++ b/src/options.c
@@ -6,18 +6,26 @@
static void print_usage(const char *progname)
{
- printf("Usage: %s [-c config_file] [-i input_directory] [-o output_directory]\n",
+ printf("Usage: %s [-c config_file] [-v[v[v]]] [-q[q[q]]] [-h]\n"
+ " -v Increase output verbosity\n"
+ " -q Decrease output verbosity\n"
+ " -c Specifiy configuration file to read (default 'config.lua')\n"
+ " -h Print this help message and exit\n",
progname);
}
int parse_options(struct argent_options *opts, int argc, char **argv)
{
- opts->log_level = 0;
+ opts->log_level = WARN;
opts->conf_filename = "config.lua";
int opt;
- while ((opt = getopt(argc, argv, "vc:")) != -1) {
+ while ((opt = getopt(argc, argv, "hqvc:")) != -1) {
switch (opt) {
+ case 'q':
+ opts->log_level -= 1;
+ break;
+
case 'v':
opts->log_level += 1;
break;
@@ -26,6 +34,10 @@ int parse_options(struct argent_options *opts, int argc, char **argv)
opts->conf_filename = optarg;
break;
+ case 'h':
+ print_usage(argv[0]);
+ return 2;
+
default:
print_usage(argv[0]);
return 1;