]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.c
notmuch: Add a version (0.1 initially) with a new --version option.
[notmuch] / notmuch.c
index 95f057eae21b2289df61cc373b354fe0885a07a6..e519f98e7013b1d0ff3e83cb3b4c730563d8fe3c 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -307,7 +307,10 @@ usage (FILE *out)
     command_t *command;
     unsigned int i;
 
-    fprintf (out, "Usage: notmuch <command> [args...]\n");
+    fprintf (out,
+            "Usage: notmuch --help\n"
+            "       notmuch --version\n"
+            "       notmuch <command> [args...]\n");
     fprintf (out, "\n");
     fprintf (out, "Where <command> and [args...] are as follows:\n");
     fprintf (out, "\n");
@@ -457,6 +460,14 @@ 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);
+
+    if (STRNCMP_LITERAL (argv[1], "--version") == 0) {
+       printf ("notmuch version " STRINGIFY(NOTMUCH_VERSION) "\n");
+       return 0;
+    }
+
     for (i = 0; i < ARRAY_SIZE (commands); i++) {
        command = &commands[i];