From 9f004d3b728b8b15d5d5cb5d18cbd08d9ae3da72 Mon Sep 17 00:00:00 2001 From: Martin Preisler Date: Mon, 11 Jan 2016 14:17:42 +0100 Subject: [PATCH] Print version with -v or --version in oscapd-cli --- bin/oscapd-cli | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/oscapd-cli b/bin/oscapd-cli index 0b92a58..4a205ac 100755 --- a/bin/oscapd-cli +++ b/bin/oscapd-cli @@ -513,11 +513,17 @@ def confirm(prompt, default=False): sys.stderr.write("Operation aborted.\n") return default + def main(): parser = argparse.ArgumentParser( description="OpenSCAP-Daemon command line interface." ) + parser.add_argument( + "-v", "--version", action="version", + version="%(prog)s " + version.VERSION_STRING + ) subparsers = parser.add_subparsers() + task_accessor = TaskAccessor() task_accessor.add_setter("enabled", @@ -689,6 +695,10 @@ def main(): args = parser.parse_args() + if args.version: + print("OpenSCAP-daemon CLI %s" % (version.VERSION_STRING)) + sys.exit(0) + gobject.threads_init() dbus_iface = None