mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-23 23:40:34 +01:00
cli: improve handling of quoting in bash completion
_init_completion returns the '${words[@]}' array with all the
quotes and escapes. We dont care about it so we drop (unescape)
first.
Before, the following failed:
nmcli 'c' <TAB>
nmcli connection modify id Wireless\ Connection\ 1 <TAB>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
0e5de01cc8
commit
ed60815d4c
1 changed files with 6 additions and 0 deletions
|
|
@ -538,6 +538,12 @@ _nmcli()
|
|||
# right of the cursor, just ignore them. Also don't care about ${words[0]}.
|
||||
words=("${words[@]:1:$cword}")
|
||||
|
||||
# _init_completion returns the words with all the quotes and escaping
|
||||
# characters. We don't care about them, drop them at first.
|
||||
for i in ${!words[*]}; do
|
||||
words[i]="$(echo "${words[i]}" | xargs 2>/dev/null || true)"
|
||||
done
|
||||
|
||||
_nmcli_complete_OPTIONS && return 0
|
||||
|
||||
local command="${words[1]}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue