From 625d9e05d8e8121d761dc2d5791775954d997a5b Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 25 Mar 2022 16:13:43 +0100 Subject: [PATCH] completions/nmcli: Exit if networkmanager isn't running These printed an error on load if networkmanager isn't running. Since at that point it's not useful to complete anything, just try the first call and if that fails exit. (cherry picked from commit b6f47f76f00ecf2b019de7fd91aa5b8a698679d5) --- share/completions/nmcli.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/completions/nmcli.fish b/share/completions/nmcli.fish index 3a8be8c40..729f20467 100644 --- a/share/completions/nmcli.fish +++ b/share/completions/nmcli.fish @@ -1,4 +1,6 @@ -set -l cname (string escape -- (nmcli -g NAME connection show --active)\t"Active connection") +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")