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



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

    main: add --version option

 gnome-flashback/gf-main.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/gnome-flashback/gf-main.c b/gnome-flashback/gf-main.c
index 95444e2..b75b340 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
   }
@@ -85,6 +92,15 @@ parse_arguments (int    *argc,
   if (debug)
     g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
 
+  if (version)
+  {
+    g_print (PACKAGE_STRING "\n");
+    g_print ("This is free software; see the source for copying conditions.\n");
+    g_print ("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
+
+    exit(0);
+  }
+
   g_option_context_free (context);
 
   return TRUE;


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