[omd-commits] OMD Git: omd: omd: new option --bare for omd version

git version control git at mathias-kettner.de
Wed Jun 29 10:19:16 CEST 2011


Module:   omd
Branch:   master
Commit:   4929cd58d35565ee6e503753598cc91f803c385b
URL:      http://omdistro.org/projects/omd/repository/revisions/4929cd58d35565ee6e503753598cc91f803c385b

Author:   Mathias Kettner <mk at mathias-kettner.de>
Date:     Tue Jun 28 14:14:14 2011 +0200
Commiter: Mathias Kettner <mk at mathias-kettner.de>
Date:     Tue Jun 28 14:14:14 2011 +0200

omd: new option --bare for omd version

---

 packages/omd/omd   |    7 +++++--
 packages/omd/omd.8 |    4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/packages/omd/omd b/packages/omd/omd
index c53e407..921064a 100644
--- a/packages/omd/omd
+++ b/packages/omd/omd
@@ -1878,7 +1878,10 @@ def use_update_alternatives():
 
 
 def main_version(args, options={}):
-    sys.stdout.write("OMD - Open Monitoring Distribution Version %s\n" % g_info["OMD_VERSION"])
+    if "bare" in options:
+        sys.stdout.write(g_info["OMD_VERSION"] + "\n")
+    else:
+        sys.stdout.write("OMD - Open Monitoring Distribution Version %s\n" % g_info["OMD_VERSION"])
 
 
 def main_versions(args, options={}):
@@ -2362,7 +2365,7 @@ commands = [
     ""),
 
   ( "version",   False, 0, 0, False, "",        main_version,
-    [],
+    [("bare", "b", False)],
     "Show version of OMD",
     ""),
 
diff --git a/packages/omd/omd.8 b/packages/omd/omd.8
index 642d08d..61eace0 100644
--- a/packages/omd/omd.8
+++ b/packages/omd/omd.8
@@ -47,9 +47,11 @@ sites within OMD - the open monitoring distribution.
 .B omd help
 Show short summary of available commands.
 .TP
-.B omd version
+.B omd version [--bare, -b]
 Show the default version of you OMD installation. OMD supports
 multiple versions to be installed in parallel.
+The option \fB-b\fP or \fB--bare\fP reduces the output to the plain
+version number (for easier parsing in scripts).
 .TP
 .B omd versions [--bare, -b]
 Show a list of all installed versions of OMD. The option \fB-b\fP or \fB--bare\fP



More information about the omd-commits mailing list