[Tracker] [PATCH 06/10] tracker-info: add "--version" option



---
 src/tracker-utils/tracker-info.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/tracker-utils/tracker-info.c b/src/tracker-utils/tracker-info.c
index f94fecc..1856846 100644
--- a/src/tracker-utils/tracker-info.c
+++ b/src/tracker-utils/tracker-info.c
@@ -33,8 +33,13 @@
 #include <libtracker-common/tracker-common.h>
 
 static gchar        **filenames = NULL;
+static gboolean       print_version;
 
 static GOptionEntry   entries[] = {
+       { "version", 'v', 0, G_OPTION_ARG_NONE, &print_version,
+         N_("Print version"),
+         NULL,
+       },
        { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames,
          N_("FILE"),
          N_("FILE")},
@@ -91,6 +96,13 @@ main (int argc, char **argv)
        g_option_context_add_main_entries (context, entries, NULL);
        g_option_context_parse (context, &argc, &argv, NULL);
 
+       if (print_version) {
+               g_print ("%s\n", PACKAGE_STRING);
+               g_option_context_free (context);
+
+               return EXIT_SUCCESS;
+       }
+
        if (!filenames) {
                gchar *help;
 
-- 
1.6.3.3




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