Skip to content

Commit

Permalink
Align the ping column
Browse files Browse the repository at this point in the history
  • Loading branch information
davesteele committed Jul 16, 2021
1 parent 585d202 commit 52a844b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions comitup_watch/comitup_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from pathlib import Path
from typing import NamedTuple

import tabulate
from colorama import Fore, Back, Style
from tabulate import tabulate

from .avahi_watch import AvahiMessage
from .devicemon import DeviceMonMsg
Expand Down Expand Up @@ -202,7 +202,7 @@ def get_display_row(self):
if self.ping_status is None:
pstat = None
else:
pstat = "\u2714" if self.ping_status else "\u274C"
pstat = " \u2714" if self.ping_status else " \u274C"

return [
self.colorize("nm", self.ssid),
Expand Down Expand Up @@ -332,7 +332,8 @@ def print_list(self):

header = ["SSID", "Domain Name", "IPv4", "IPv6", "Ping"]

table_text = tabulate(self.test_table(), header)
tabulate.PRESERVE_WHITESPACE = True
table_text = tabulate.tabulate(self.test_table(), header)
width = max(len(x) for x in table_text.split("\n") if "--" in x)

print("-" * width)
Expand Down

0 comments on commit 52a844b

Please sign in to comment.