[Tracker] [PATCH 02/10] tracker-stats: add "--version" option



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

diff --git a/src/tracker-utils/tracker-stats.c b/src/tracker-utils/tracker-stats.c
index 1bc1092..b1cc55b 100644
--- a/src/tracker-utils/tracker-stats.c
+++ b/src/tracker-utils/tracker-stats.c
@@ -31,6 +31,16 @@
 
 #include <libtracker-client/tracker.h>
 
+static gboolean print_version;
+
+static GOptionEntry entries[] = {
+       { "version", 'v', 0, G_OPTION_ARG_NONE, &print_version,
+         N_("Print version"),
+         NULL
+       },
+       { NULL }
+};
+
 static void
 get_meta_table_data (gpointer value)
 {
@@ -68,7 +78,16 @@ main (int argc, char **argv)
        /* Translators: this messagge will apper immediately after the  */
        /* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE>     */
        context = g_option_context_new (_(" - Show statistics for all Nepomuk defined ontology classes"));
+       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;
+       }
+
        g_option_context_free (context);
 
        client = tracker_connect (FALSE, G_MAXINT);
-- 
1.6.3.3




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