From 8efc92afaf9ac3f516ba2b4dc70ce60280a8c908 Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 24 Jul 2017 23:23:02 +0200
Subject: [PATCH] Show --bug-info separate from version.

Do not print to much in case the user is only interested in the current
used version. So show vimb version only on options -v, --version and
added the new option --bug-version which shows the currently used libs
and the library versions vimb was compiled against.
---
 .github/ISSUE_TEMPLATE.md | 2 +-
 CHANGELOG.md              | 4 ++--
 doc/vimb.1                | 5 ++++-
 src/main.c                | 7 ++++++-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 433da4c..91bdb03 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,5 +1,5 @@
 <!-- If this is a bug report, please provide your version information
-$ vimb --version -->
+$ vimb --bug-info -->
 ### Steps to reproduce
 
 ### Expected behaviour
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 624501f..7ccdceb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,8 +22,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
   the first char.
   * `hint-keys=0123` -> `1 2 3 10 11 12 13`
   * `hint-keys=asdf` -> `a s d f aa as ad af`
-* Show versions of used libs on `vimb -v` and the extension directory for
-  easier issue investigation.
+* Show versions of used libs on `vimb --bug-info` and the extension directory
+  for easier issue investigation.
 * During hinting JavaScript is enabled and reset to it's previous setting after
   hinting is done might be security relevant.
 * Allow extended hints mode also for open `g;o` to allow the user to toggle
diff --git a/doc/vimb.1 b/doc/vimb.1
index a26b0c4..d1078f9 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -46,7 +46,10 @@ Configuration data for the profile is stored in a directory named
 \fIPROFILE-NAME\fP under default directory for configuration data.
 .TP
 .B "\-v, \-\-version"
-Print build and version information.
+Print build and version information and then quit.
+.TP
+.B "\-\-bug-info"
+Prints information about used libraries for bug reports and then quit.
 .SH MODES
 Vimb is modal and has the following main modes:
 .TP
diff --git a/src/main.c b/src/main.c
index c00e80a..131c149 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1764,13 +1764,14 @@ int main(int argc, char* argv[])
     Client *c;
     GError *err = NULL;
     char *pidstr, *winid = NULL;
-    gboolean ver = FALSE;
+    gboolean ver = FALSE, buginfo = FALSE;
 
     GOptionEntry opts[] = {
         {"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL},
         {"config", 'c', 0, G_OPTION_ARG_FILENAME, &vb.configfile, "Custom configuration file", NULL},
         {"profile", 'p', 0, G_OPTION_ARG_CALLBACK, (GOptionArgFunc*)profileOptionArgFunc, "Profile name", NULL},
         {"version", 'v', 0, G_OPTION_ARG_NONE, &ver, "Print version", NULL},
+        {"bug-info", 0, 0, G_OPTION_ARG_NONE, &buginfo, "Print used library versions", NULL},
         {NULL}
     };
 
@@ -1784,6 +1785,10 @@ int main(int argc, char* argv[])
 
     if (ver) {
         printf("%s, version %s\n\n", PROJECT, VERSION);
+        return EXIT_SUCCESS;
+    }
+
+    if (buginfo) {
         printf("Commit:          %s\n", COMMIT);
         printf("WebKit compile:  %d.%d.%d\n",
                 WEBKIT_MAJOR_VERSION,
-- 
2.20.1