diff options
author | Yorhel <git@yorhel.nl> | 2013-04-14 09:51:45 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2013-04-14 09:51:45 +0200 |
commit | b54959df98d29dd3aec1725c239db261d4f28d7c (patch) | |
tree | fcd10fd36b18cfe921e2a771f2b59cf9a399fb81 | |
parent | b6ad61b41abcdffb2123ca275475a5f2aa81bf24 (diff) |
main: Added -h,--help option to globster(1)
-rw-r--r-- | doc/globster.pod | 4 | ||||
-rw-r--r-- | src/main.c | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/globster.pod b/doc/globster.pod index 8067a41..66c41c2 100644 --- a/doc/globster.pod +++ b/doc/globster.pod @@ -25,6 +25,10 @@ Log messages are printed on standard error. Print version information and exit. +=item -h, --help + +Print a short help message and exit. + =item --system Connect to the system D-Bus. @@ -124,6 +124,18 @@ static void init_crypt() { } +static void print_help() { + puts("globster <options>\n\n" + " -V, --version Print version information and exit\n" + " -h, --help This help message\n" + " --system Connect to the D-Bus system bus\n" + " --session Connect to the D-Bus session bus (default)\n" + " --log-level Set the log level\n" + " -c, --session-dir PATH Set the session directory\n" + " -n Disable autoconnect"); +} + + static void argv_parse(int argc, char **argv) { yopt_t yopt; int v; @@ -131,6 +143,7 @@ static void argv_parse(int argc, char **argv) { static const yopt_opt_t opts[] = { { 'V', 0, "-V,--version" }, + { 'h', 0, "-h,--help" }, { 'Y', 0, "--system" }, { 'S', 0, "--session" }, { 'L', 1, "--log-level" }, @@ -145,6 +158,9 @@ static void argv_parse(int argc, char **argv) { case 'V': printf("%s version %s\n", PACKAGE, app_version_long()); exit(0); + case 'h': + print_help(); + exit(0); case 'Y': conf_system = true; break; case 'S': conf_system = false; break; case 'L': conf_log_level = val; break; |