[Git][NTPsec/ntpsec][master] ntpviz: add -V. print version and exit
Gary E. Miller
gitlab at mg.gitlab.com
Fri Nov 4 22:09:53 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
4b547be6 by Gary E. Miller at 2016-11-04T15:07:30-07:00
ntpviz: add -V. print version and exit
also --version
- - - - -
2 changed files:
- docs/includes/ntpviz-body.txt
- ntpstats/ntpviz
Changes:
=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -24,6 +24,7 @@ ntpviz [-d LOGDIR] [-g] [-n name] [-p DAYS]
--peer-offsets=hosts |
]
[-D DLVL | --debug DLVL]
+ [-V | --version]
[@OPTIONFILE]
== DESCRIPTION ==
@@ -85,6 +86,9 @@ subset of comparative plots for multiple directories.
2 leaves the plot file in the system temp directory. +
9 is painfully verbose. 9 also includes profile data.
+-V or --version:
+ Print program version and exit.
+
=== Individual Plots ===
The plot options choose what graph is generated; invoke only one. By
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -5,7 +5,7 @@ ntpviz - logfile visualizer for NTP log files
Usage: ntpviz [-d statsdir] [-g] [-n name] [-p days]
[-s starttime] [-e endtime]
- [ -c | --clip ]
+ [-c | --clip ]
[--local-offset | --local-error | --local-jitter
| --local-stability | --local-offset-histogram
| --peer-offsets=hosts | --all-peer-offsets
@@ -15,7 +15,9 @@ Usage: ntpviz [-d statsdir] [-g] [-n name] [-p days]
| --local-offset-multiplot]
[-o outdir]
[-w SIZE | --width SIZE]
- [-D N]
+ [-D DLVL | --debug DLVL]
+ [-V | --version ]
+ [@OPTIONFILE]
See the manual page for details.
@@ -31,6 +33,7 @@ import atexit, binascii, collections, os, socket, sys
import time
import tempfile
from ntp.statfiles import *
+import ntp.version
# overload ArgumentParser
class MyArgumentParser(argparse.ArgumentParser):
@@ -1170,10 +1173,21 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
dest='debug_level',
help="debug level, 0 (none) to 9 (most)",
type=int)
- # FIXME, missing -V and --version
+ parser.add_argument('-V', '--version',
+ action="store_true",
+ default=False,
+ dest='version',
+ help="Print version and exit")
args = parser.parse_args()
+ version = "%s %s+%s" % ( ntp.version.BASENAME, ntp.version.VERSION, \
+ ntp.version.TICK)
+
+ if args.version:
+ print(version)
+ raise SystemExit(1)
+
if 's' == args.width:
# fit in 1024x768 browser
# in 2016 this is 22% of all browsers
@@ -1212,6 +1226,7 @@ Python by ESR, concept and GNUPLOT code by Dan Drown.
if 0 < args.debug_level:
sys.stderr.write("ntpviz: INFO: now running at debug: %s\n" % \
args.debug_level)
+ sys.stderr.write("ntpviz: INFO: Version: %s\n" % version)
sys.stderr.write("ntpviz: INFO: Parsed Options %s\n" % args)
if 9 == args.debug_level:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4b547be68667829f9aeac4f00aa528768eed2d2b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161104/1f83fb2e/attachment.html>
More information about the vc
mailing list