mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 03:30:14 +01:00
cli: completion: escape shell special characters "()&!"
https://bugzilla.gnome.org/show_bug.cgi?id=772629
(cherry picked from commit 108f04e71e)
This commit is contained in:
parent
940cb6eb87
commit
c53496fe4a
1 changed files with 6 additions and 1 deletions
|
|
@ -25,10 +25,11 @@ _nmcli_list_nl()
|
|||
# [']bla'bla"bla\bla bla --> [']bla'\''bla"bla\bla bla
|
||||
COMPREPLY[$i]="${entry//\'/${escaped_single_quote}}"
|
||||
elif [[ "${cur:0:1}" == '"' ]]; then
|
||||
# started with double quote, escaping all double quotes and all backslashes
|
||||
# started with double quote, escaping all double quotes, backslashes and !
|
||||
# ["]bla'bla"bla\bla bla --> ["]bla'bla\"bla\\bla bla
|
||||
entry="${entry//\\/\\\\}"
|
||||
entry="${entry//\"/\\\"}"
|
||||
entry="${entry//!/\"\\!\"}"
|
||||
COMPREPLY[$i]="$entry"
|
||||
else
|
||||
# no quotes in front, escaping _everything_
|
||||
|
|
@ -37,6 +38,10 @@ _nmcli_list_nl()
|
|||
entry="${entry//\'/\'}"
|
||||
entry="${entry//\"/\\\"}"
|
||||
entry="${entry// /\\ }"
|
||||
entry="${entry//\(/\\(}"
|
||||
entry="${entry//)/\\)}"
|
||||
entry="${entry//!/\\!}"
|
||||
entry="${entry//&/\\&}"
|
||||
COMPREPLY[$i]="$entry"
|
||||
fi
|
||||
(( i++ ))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue