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 b6f47f76f0)
This commit is contained in:
Fabian Homborg 2022-03-25 16:13:43 +01:00
parent 8f11ebb9d4
commit 625d9e05d8

View file

@ -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")