[Tracker] [PATCH 07/10] tracker-import: add "--version" option



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

diff --git a/src/tracker-utils/tracker-import.c b/src/tracker-utils/tracker-import.c
index 2612118..2c008c9 100644
--- a/src/tracker-utils/tracker-import.c
+++ b/src/tracker-utils/tracker-import.c
@@ -34,8 +34,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")},
@@ -64,6 +69,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]