Welcome to little lamb

Code » qmdoc » commit 1b82c69

Add -V/--version

author Olivier Brunel
2023-01-16 17:07:05 UTC
committer Olivier Brunel
2023-01-16 17:07:05 UTC
parent ebdc0ddb997a82f94effbd117ef11981988bc2ad

Add -V/--version

src/main.c +6 -1

diff --git a/src/main.c b/src/main.c
index 7d0be3c..8c0e93d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1428,6 +1428,7 @@ help(void)
             " -s, --subtitle TEXT           Set TEXT as general subtitle\n"
             " -T, --no-toc                  Don't write a TOC on each page. Implies --no-index\n"
             " -t, --title TITLE             Set TITLE as general (across all pages) title\n"
+            " -V, --version                 Show version screen and exit\n"
             " -W, --wide-include            Include header/footer right within <body>\n"
             " -X, --no-index                Disable index mode\n"
            );
@@ -1479,11 +1480,12 @@ main (int argc, char *argv[])
         { "subtitle",       required_argument,  NULL,   's' },
         { "no-toc",         no_argument,        NULL,   'T' },
         { "title",          required_argument,  NULL,   't' },
+        { "version",        no_argument,        NULL,   'V' },
         { "wide-includes",  no_argument,        NULL,   'W' },
         { "no-index",       no_argument,        NULL,   'X' },
         { NULL,             0,                  NULL,    0  },
     };
-    while ((c = getopt_long(argc, argv, "a:bCc:d:F:H:hIil:M:os:Tt:WX", opts, NULL)) != -1) switch (c) {
+    while ((c = getopt_long(argc, argv, "a:bCc:d:F:H:hIil:M:os:Tt:VWX", opts, NULL)) != -1) switch (c) {
         case 'a':
             ctx.doc.author = optarg;
             break;
@@ -1531,6 +1533,9 @@ main (int argc, char *argv[])
         case 't':
             ctx.doc.title = optarg;
             break;
+        case 'V':
+            dieversion(QMDOC_VERSION, "2023", QMDOC_CURYEAR, QMDOC_AUTHOR, QMDOC_URL, NULL);
+            break;
         case 'W':
             ctx.options |= OPT_WIDE_INC;
             break;