[Tracker] [PATCH 03/10] tracker-tag: add "--version" option



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

diff --git a/src/tracker-utils/tracker-tag.c b/src/tracker-utils/tracker-tag.c
index 90a7795..5868b9c 100644
--- a/src/tracker-utils/tracker-tag.c
+++ b/src/tracker-utils/tracker-tag.c
@@ -39,6 +39,7 @@ static gchar      *add_tag;
 static gchar       *remove_tag;
 static gboolean     *list;
 static gboolean      show_files;
+static gboolean      print_version;
 
 static GOptionEntry entries[] = {
        { "limit", 'l', 0, G_OPTION_ARG_INT, &limit,
@@ -69,6 +70,10 @@ static GOptionEntry entries[] = {
          N_("Delete a tag (if FILEs are omitted, TAG is removed for all files)"),
          N_("TAG")
        },
+       { "version", 'v', 0, G_OPTION_ARG_NONE, &print_version,
+         N_("Print version"),
+         NULL
+       },
        { G_OPTION_REMAINING, 0, 
          G_OPTION_FLAG_FILENAME,
          G_OPTION_ARG_STRING_ARRAY, &files,
@@ -629,6 +634,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 (!list && show_files) {
                failed = _("The --list option is required for --show-files");
        } else if (add_tag && remove_tag) {
-- 
1.6.3.3




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