[gnome-maps] application: Add --version command line arguement



commit 93c08b38073be4ac85f76b343a915c5654ede53d
Author: Anup Agarwal <108anup gmail com>
Date:   Wed Jan 11 14:32:47 2017 +0530

    application: Add --version command line arguement
    
    Adds a --version command line option.
    The version flag is handled in the same location where the local flag is handled
    i.e.'handle-local-options' signal handler
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777020

 src/application.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 3bcef84..b1631f9 100644
--- a/src/application.js
+++ b/src/application.js
@@ -102,11 +102,20 @@ var Application = new Lang.Class({
                              _("A path to a local tiles directory structure"),
                              null);
 
+        this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+                             _("Show the version of the program"), null);
+
         this.connect('handle-local-options', (function(app, options) {
             if (options.contains('local')) {
                 let variant = options.lookup_value('local', null);
                 this.local_tile_path = variant.deep_unpack();
                 normalStartup = false;
+            } else if (options.contains('version')) {
+                print(pkg.version);
+                /* quit the invoked process after printing the version number
+                 * leaving the running instance unaffected
+                 */
+                return 0;
             }
 
             return -1;


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