nmcli: fix argument completion if nmcli is aliased
If an alias like `nmcli=nmcli --some-arguments` is used, bash completion doesn't work. Fix it by using `command nmcli` from the nmcli-completion script, so we ensure that the --complete-args is passed directly to nmcli binary, not through an alias. Contributed-by: Jonas Belouadi (@potamides) Fixes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1734
This commit is contained in:

committed by
Íñigo Huguet

parent
8b8fc44b19
commit
78f179b53e
@@ -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
|
||||
|
Reference in New Issue
Block a user