[Git][NTPsec/ntpsec][master] In ntpmon, add space command to rotate through peer display modes.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 13 19:31:23 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
c95f0b4b by Eric S. Raymond at 2016-12-13T14:30:38-05:00
In ntpmon, add space command to rotate through peer display modes.

- - - - -


2 changed files:

- docs/includes/ntpmon-body.txt
- ntpclients/ntpmon


Changes:

=====================================
docs/includes/ntpmon-body.txt
=====================================
--- a/docs/includes/ntpmon-body.txt
+++ b/docs/includes/ntpmon-body.txt
@@ -45,5 +45,8 @@ w:: Toggle wide mode.
 
 x:: Cleanly terminate the program.
 
+<space>:: Rotate through all three peer display modes.
+
+?:: List these commands.
 
 // end


=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -1,24 +1,28 @@
 #!/usr/bin/env python
 # SPDX-License-Identifier: BSD-2-clause
-"""
+'''\
 Keystroke commands:
 
-a: Change peer display to apeers mode, showing association IDs.
+'a': Change peer display to apeers mode, showing association IDs.
 
-n: Toggle display of hostnames (vs. IP addresses).
+'n': Toggle display of hostnames (vs. IP addresses).
 
-o: Change peer display to opeers mode, showing destination address.
+'o': Change peer display to opeers mode, showing destination address.
 
-p: Change peer display to default mode, showing refid
+'p': Change peer display to default mode, showing refid
 
-q: Cleanly terminate the program.
+'q': Cleanly terminate the program.
 
-s: Show all hosts, not just reachable ones.
+'s': Show all hosts, not just reachable ones.
 
-w: Toggle wide mode.
+'w': Toggle wide mode.
 
-x: Cleanly terminate the program.
-"""
+'x': Cleanly terminate the program.
+
+' ': Rotate through all three peer display modes. 
+
+'?': Display helpscreen
+'''
 
 from __future__ import print_function, division
 
@@ -180,6 +184,13 @@ if __name__ == '__main__':
                         showall = not showall
                     elif key == 'w':
                         peer_report.wideremote = not peer_report.wideremote
+                    elif key == " ":
+                        if peer_report.displaymode == 'peers':
+                            peer_report.displaymode = 'apeers'
+                        elif peer_report.displaymode == 'apeers':
+                            peer_report.displaymode = 'opeers'
+                        else:
+                            peer_report.displaymode = 'peers'
                     elif key == '?':
                         helpmode = True
                 except curses.error:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c95f0b4b200fee760e9009d6cbc18e34269c451d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161213/0825f0c0/attachment.html>


More information about the vc mailing list