aboutsummaryrefslogtreecommitdiff
path: root/notmuch.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-04-02 11:53:22 -0700
committerCarl Worth <cworth@cworth.org>2010-04-02 11:53:22 -0700
commit9d9aeb7c71a52b67519f567c34acc3cf3bec6fd2 (patch)
treedcaffcc56403508465097bae2dae78e1774a445b /notmuch.c
parentf689c83af4e1d271d056b24da9e46e7b679ff978 (diff)
notmuch: Add support for a --help option.
Previously, only "notmuch help" worked while a call to "notmuch --help" would just print a message telling the user to call "notmuch help". Instead of the redirection, just support --help directly now.
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/notmuch.c b/notmuch.c
index 95f057e..3b743a9 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -307,7 +307,9 @@ usage (FILE *out)
command_t *command;
unsigned int i;
- fprintf (out, "Usage: notmuch <command> [args...]\n");
+ fprintf (out,
+ "Usage: notmuch --help\n"
+ " notmuch <command> [args...]\n");
fprintf (out, "\n");
fprintf (out, "Where <command> and [args...] are as follows:\n");
fprintf (out, "\n");
@@ -457,6 +459,9 @@ main (int argc, char *argv[])
if (argc == 1)
return notmuch (local);
+ if (STRNCMP_LITERAL (argv[1], "--help") == 0)
+ return notmuch_help_command (NULL, 0, NULL);
+
for (i = 0; i < ARRAY_SIZE (commands); i++) {
command = &commands[i];