[tracker] tracker-import: add "--version" option



commit a556a7bbd7ecb662ec115cb55d97211a6d019e1f
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Wed Nov 18 10:08:26 2009 +0100

    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;
 



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