[gnome-sound-recorder] Add --version option



commit 973313754ccf9c6048cffd0abfe16aa20ed3e7ad
Author: Elias Papavasileiou <eliaspap pm me>
Date:   Wed Jul 24 15:24:03 2019 +0300

    Add --version option

 src/application.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/application.js b/src/application.js
index 1fdeea6..4f496f5 100644
--- a/src/application.js
+++ b/src/application.js
@@ -39,6 +39,20 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         super._init({ application_id: pkg.name });
         GLib.set_application_name(_("SoundRecorder"));
         GLib.set_prgname("gnome-sound-recorder");
+
+        this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+                             "Print version information and exit", null);
+
+        this.connect('handle-local-options', (app, options) => {
+            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;
+        });
     }
 
     _initAppMenu() {


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