[polari] app: Add --version CLI option
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Add --version CLI option
- Date: Tue, 11 Apr 2017 00:50:22 +0000 (UTC)
commit 9f4d573edff92dcd2922b3a1426da19506d1a2eb
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Mar 15 12:08:57 2017 +0100
app: Add --version CLI option
It's sometimes convenient to check the version without running the
program to open the about dialog, so add support for the standard
--version option.
https://bugzilla.gnome.org/show_bug.cgi?id=780272
src/application.js | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index aad845a..d73f6fe 100644
--- a/src/application.js
+++ b/src/application.js
@@ -43,6 +43,9 @@ const Application = new Lang.Class({
this.add_main_option('start-client', 0,
GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
_("Start Telepathy client"), null);
+ this.add_main_option('version', 0,
+ GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+ _("Print version and exit"), null);
this.connect('handle-local-options', (o, dict) => {
try {
this.register(null);
@@ -56,6 +59,12 @@ const Application = new Lang.Class({
return 0;
}
+ v = dict.lookup_value('version', null);
+ if (v && v.get_boolean()) {
+ print("Polari %s".format(pkg.version));
+ return 0;
+ }
+
return -1;
});
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]