| 114 | * @param {object[]} wifiList |
| 115 | */ |
| 116 | export async function printWifiListTable( |
| 117 | wifiList: WifiAccessPoint[] |
| 118 | ): Promise<void> { |
| 119 | const rows = [['WIFI', 'Signal strength']]; |
| 120 | |
| 121 | for (const { ssid, bssid, channel, encryption, cipher, signal } of wifiList) { |
| 122 | rows.push([ |
| 123 | `${ |
| 124 | ssid ? ssid : '<hidden>' |
| 125 | }\n^B${bssid}^ ^+^YCh:^ ${channel} ^+^YEncryption:^ ${encryption} ^+^YCipher:^ ${cipher}`, |
| 126 | bar(signal / 100, 20), |
| 127 | ]); |
| 128 | } |
| 129 | |
| 130 | const thisTableOptions = tableOptions; |
| 131 | thisTableOptions.firstColumnVoidAttr = { contentWidth: 55 }; |
| 132 | thisTableOptions.firstColumnTextAttr = { color: 'cyan' }; |
| 133 | thisTableOptions.firstRowTextAttr = { color: 'yellow' }; |
| 134 | |
| 135 | terminal.table(rows, thisTableOptions); |
| 136 | } |