merge: branch 'ih/nmcli-complete'

nmcli: fix argument completion if nmcli is aliased

Closes #1734

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2159
This commit is contained in:
Íñigo Huguet 2025-03-24 14:29:42 +00:00
commit 45e7e158c1

View file

@ -49,7 +49,10 @@ _nmcli()
cur=''
fi
output="$(nmcli --complete-args "${words[@]}" 2>/dev/null)"
# If the user set an alias like `nmcli=nmcli --some-arguments`, then --complete-args
# might give unexpected behaviours. Use `command` to ensure that aliases are ignored
# and the nmcli binary is used directly.
output="$(command nmcli --complete-args "${words[@]}" 2>/dev/null)"
# Bail out early if we're completing a file name
if [ $? = 65 ]; then