diff options
author | Clark Williams <williams@redhat.com> | 2016-04-21 16:34:31 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2016-04-21 16:34:31 -0500 |
commit | c2b6e7dcd735b98d52c09cd4b08cf6e0da61519a (patch) | |
tree | 8aad65a30bd593befb391d88a156a01d7369aedb /rteval-cmd | |
parent | 849e04a02a6bbc954f5692070e75d22f709538d5 (diff) | |
download | rteval-c2b6e7dcd735b98d52c09cd4b08cf6e0da61519a.tar.gz |
options: add --version option and handle empty argument list
Added the -V/--version option to print the rteval version number
and exit.
Added code to handle no arguments, which will trigger a usage message
from the option parser.
Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'rteval-cmd')
-rwxr-xr-x | rteval-cmd | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -41,7 +41,7 @@ from rteval.Log import Log from rteval import RtEval, rtevalConfig from rteval.modules.loads import LoadModules from rteval.modules.measurement import MeasurementModules - +from rteval.version import RTEVAL_VERSION def summarize(repfile, xslt): @@ -153,8 +153,18 @@ def parse_options(cfg, parser, cmdargs): parser.add_option("-O", "--onlyload", dest="rteval___onlyload", action='store_true', default=False, help="only run the loads (don't run measurement threads)") + parser.add_option("-V", "--version", dest="rteval__version", + action='store_true', default=False, + help='print rteval version and exit') + + if not cmdargs: + cmdargs = ["--help"] (cmd_opts, cmd_args) = parser.parse_args(args = cmdargs) + if cmd_opts.rteval__version: + print("rteval version %s" % RTEVAL_VERSION) + sys.exit(0); + if cmd_opts.rteval___duration: mult = 1.0 v = cmd_opts.rteval___duration.lower() |