From 33f830b43276d176fbe66487fb2109abad9e9281 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 24 Jan 2026 21:17:13 +0100 Subject: [PATCH] statd: add BSSID to table of available networks Also, spruce up the table a bit. Allow it to resize, let the SSID column be flexible, and right-align column(s) with numbers. Signed-off-by: Joachim Wiberg --- src/statd/python/cli_pretty/cli_pretty.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/statd/python/cli_pretty/cli_pretty.py b/src/statd/python/cli_pretty/cli_pretty.py index 348491d1..246d5d38 100755 --- a/src/statd/python/cli_pretty/cli_pretty.py +++ b/src/statd/python/cli_pretty/cli_pretty.py @@ -345,8 +345,11 @@ class SimpleTable: # Add separator " " only between columns, not after the last one separator = "" if is_last else " " - # Don't pad the last column to avoid trailing spaces + # Don't add trailing spaces to the last column if is_last: + if column.align == 'right': + padding = width - visible_len + return ' ' * max(0, padding) + value_str return value_str elif column.align == 'right': padding = width - visible_len @@ -1230,22 +1233,26 @@ class Iface: print(row) def pr_wifi_ssids(self): - print("\nAVAILABLE NETWORKS:") + width = 70 + Decore.title("Available Networks", width) ssid_table = SimpleTable([ - Column('SSID'), + Column('SSID', flexible=True), + Column('BSSID'), Column('SECURITY'), Column('SIGNAL'), - Column('CHANNEL') - ]) + Column('CHANNEL', 'right') + ], min_width=width) station = self.wifi.get("station", {}) results = station.get("scan-results", {}) for result in results: + ssid = result.get('ssid', 'Hidden') + bssid = result.get("bssid", "unknown") encstr = ", ".join(result.get("encryption", ["Unknown"])) status = rssi_to_status(result.get("rssi", -100)) channel = result.get("channel", "?") - ssid_table.row(result.get('ssid', 'Hidden'), encstr, status, channel) + ssid_table.row(ssid, bssid, encstr, status, channel) ssid_table.print() def pr_wifi_stations(self):