[pango/matthiasc/for-master] pango-list: Add --version



commit 2f07e562fc1fe370d3c7d9ce70158480a33d3a0a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 23 12:21:22 2021 -0400

    pango-list: Add --version

 utils/pango-list.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/utils/pango-list.c b/utils/pango-list.c
index 6e81fd6e..82a5647c 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -46,10 +46,12 @@ main (int    argc,
   gboolean opt_verbose = FALSE;
   gboolean opt_metrics = FALSE;
   gboolean opt_variations = FALSE;
+  gboolean opt_version = FALSE;
   GOptionEntry entries[] = {
-    {"verbose", 0, 0, G_OPTION_ARG_NONE,    &opt_verbose, "Print verbose information", NULL },
-    {"metrics", 0, 0, G_OPTION_ARG_NONE,    &opt_metrics, "Print font metrics", NULL },
-    {"variations", 0, 0, G_OPTION_ARG_NONE,    &opt_variations, "Print font variations", NULL },
+    { "verbose", 0, 0, G_OPTION_ARG_NONE, &opt_verbose, "Print verbose information", NULL },
+    { "metrics", 0, 0, G_OPTION_ARG_NONE, &opt_metrics, "Print font metrics", NULL },
+    { "variations", 0, 0, G_OPTION_ARG_NONE, &opt_variations, "Print font variations", NULL },
+    { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Show version" },
     { NULL, }
   };
   GOptionContext *context;
@@ -77,6 +79,12 @@ main (int    argc,
 
   g_option_context_free (context);
 
+  if (opt_version)
+    {
+      g_print ("%s (%s) %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION);
+      exit (0);
+    }
+
   /* Use PangoCairo to get default fontmap so it works on every platform. */
   fontmap = pango_cairo_font_map_get_default ();
   ctx = pango_font_map_create_context (fontmap);


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