aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author7415963987456321 <tetenhop@gmail.com>2019-05-10 00:21:17 +0000
committer7415963987456321 <tetenhop@gmail.com>2019-05-10 00:21:17 +0000
commit9fc019cd41612d3c991ee580c44d6b219fdfcdb6 (patch)
tree0667d46d7b90f7d0b9b51cfd8105ca11c03e1302
parente278e289896c7effb283c6b29c52b918d70251b7 (diff)
downloadimv-9fc019cd41612d3c991ee580c44d6b219fdfcdb6.tar.gz
Add version flag with -v
-rw-r--r--doc/imv.1.txt3
-rw-r--r--src/imv.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/imv.1.txt b/doc/imv.1.txt
index 6c2b45c..4a3fdaf 100644
--- a/doc/imv.1.txt
+++ b/doc/imv.1.txt
@@ -28,6 +28,9 @@ Options
*-h*::
Show help message and quit.
+*-v*::
+ Show version and quit.
+
*-b* <background>::
Set the background colour. Can either be a 6-digit hexadecimal colour code
or 'checks' to show a chequered background.
diff --git a/src/imv.c b/src/imv.c
index 24054da..a49804f 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -644,7 +644,7 @@ bool imv_parse_args(struct imv *imv, int argc, char **argv)
int o;
- while((o = getopt(argc, argv, "frdwWxhlu:s:n:b:t:")) != -1) {
+ while((o = getopt(argc, argv, "frdwWxhvlu:s:n:b:t:")) != -1) {
switch(o) {
case 'f': imv->fullscreen = true; break;
case 'r': imv->recursive_load = true; break;
@@ -658,6 +658,10 @@ bool imv_parse_args(struct imv *imv, int argc, char **argv)
print_help(imv);
imv->quit = true;
return true;
+ case 'v':
+ printf("Version: %s\n", IMV_VERSION);
+ imv->quit = true;
+ return false;
case 's':
if(!parse_scaling_mode(imv, optarg)) {
fprintf(stderr, "Invalid scaling mode. Aborting.\n");