completions/nmcli: Complete at runtime

This used to get all the interfaces and ssids when the completions
were loaded. That's obviously wrong, given that ssids especially can, you know, change
This commit is contained in:
Fabian Boehm 2025-01-27 20:45:30 +01:00
parent 4370fb755d
commit 9116c61736

View File

@ -1,10 +1,9 @@
set -l nmoutput (nmcli -g NAME connection show --active 2>/dev/null)
or exit # networkmanager isn't running, no point in completing
set -l cname (string escape -- $nmoutput\t"Active connection")
set -a cname (string escape -- (nmcli -g NAME connection show)\t"Connection")
set -l ifname (string escape -- (nmcli -g DEVICE device status)\t"Interface name")
set -l ssid (string escape -- (nmcli -g SSID device wifi list)\t"SSID")
set -l bssid (string escape -- (nmcli -g BSSID device wifi list | string replace --all \\ '')\t"BSSID")
set -l nmoutput '(nmcli -g NAME connection show --active 2>/dev/null)'
set -l cname "$nmoutput"\t"Active connection"
set -a cname '(nmcli -g NAME connection show 2>/dev/null)\t"Connection"'
set -l ifname '(nmcli -g DEVICE device status 2>/dev/null)\t"Interface name"'
set -l ssid '(nmcli -g SSID device wifi list 2>/dev/null)\t"SSID"'
set -l bssid '(nmcli -g BSSID device wifi list 2>/dev/null | string replace --all \\\ "")\t"BSSID"'
set -l nmcli_commands general networking radio connection device agent monitor help
set -l nmcli_general status hostname permissions logging help