From 9116c6173686558ba873f1667e4abd325c394b04 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 27 Jan 2025 20:45:30 +0100 Subject: [PATCH] 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 --- share/completions/nmcli.fish | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/share/completions/nmcli.fish b/share/completions/nmcli.fish index 947313b17..996683544 100644 --- a/share/completions/nmcli.fish +++ b/share/completions/nmcli.fish @@ -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