summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
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;