[gnome-flashback/wip/version] main: add --version option



commit 5b50eacedacda4fbbad13bf383821b4002a91eaa
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sat Dec 8 10:47:50 2018 +0100

    main: add --version option

 gnome-flashback/gf-main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gnome-flashback/gf-main.c b/gnome-flashback/gf-main.c
index 95444e2..eebd53c 100644
--- a/gnome-flashback/gf-main.c
+++ b/gnome-flashback/gf-main.c
@@ -31,6 +31,7 @@ static GfApplication *application = NULL;
 static gboolean debug = FALSE;
 static gboolean initialize = FALSE;
 static gboolean replace = FALSE;
+static gboolean version = FALSE;
 
 static GOptionEntry entries[] =
 {
@@ -52,6 +53,12 @@ static GOptionEntry entries[] =
     N_("Replace a currently running application"),
     NULL
   },
+  {
+    "version", 'v', G_OPTION_FLAG_NONE,
+    G_OPTION_ARG_NONE, &version,
+    N_("Print version and exit"),
+    NULL
+  },
   {
     NULL
   }
@@ -157,6 +164,13 @@ main (int argc, char *argv[])
   if (!parse_arguments (&argc, &argv))
     return EXIT_FAILURE;
 
+  if (version)
+    {
+      g_print (PACKAGE_STRING "\n");
+
+      return EXIT_FAILURE;
+    }
+
   loop = g_main_loop_new (NULL, FALSE);
   session = gf_session_new (replace, session_ready_cb, session_end_cb, NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]