3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

servermaps: simplify output format

Drawing all the |'s and `'s is a rather complex process, so just replace this with bullet-point output.
This commit is contained in:
James Lu 2016-09-24 12:02:43 -07:00
parent 60b595ea6f
commit dfa75f6606

View File

@ -65,15 +65,12 @@ def _map(irc, source, args, show_relay=True):
# Don't show relay subservers more than once.
continue
# If we reach the end of a server's map, display `- instead of |- for prettier output.
linechar = '`-' if leafcount == len(leaves)-1 else '|-'
serverusers = len(serverlist[leaf].users)
if is_relay_server:
# Skip showing user data for relay servers.
reply("%s%s\x02%s\x02[%s] (via PyLink Relay)" % (' '*hops, linechar, serverlist[leaf].name, leaf))
reply("%s-\x02%s\x02[%s] (via PyLink Relay)" % (' '*hops, serverlist[leaf].name, leaf))
else:
reply("%s%s\x02%s\x02[%s]: %s user(s) (%s%%)" % (' '*hops, linechar, serverlist[leaf].name, leaf,
reply("%s-\x02%s\x02[%s]: %s user(s) (%s%%)" % (' '*hops, serverlist[leaf].name, leaf,
serverusers, _percent(serverusers, usercount)))
showall(ircobj, leaf, hops, is_relay_server=is_relay_server)