mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 18:10:08 +01:00
nmcli: fix bash completion of words containing colon (rh #1271271)
Test:
$ sudo ip link add a🅱️c type dummy
$ nmcli device delete<Tab><Tab>
$ nmcli device delete a<Tab>
See also:
http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727
Related: https://bugzilla.gnome.org/show_bug.cgi?id=745157
https://bugzilla.redhat.com/show_bug.cgi?id=1271271
(cherry picked from commit 91dde2c865)
This commit is contained in:
parent
2d8a1ae56a
commit
ca599fad70
1 changed files with 14 additions and 0 deletions
|
|
@ -41,6 +41,20 @@ _nmcli_list_nl()
|
|||
fi
|
||||
(( i++ ))
|
||||
done
|
||||
|
||||
# Work-around bash_completion issue where bash interprets a colon
|
||||
# as a separator.
|
||||
# Colon is escaped here. Change "\\:" back to ":".
|
||||
# See also:
|
||||
# http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons
|
||||
# http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727
|
||||
i=0
|
||||
for entry in ${COMPREPLY[*]}
|
||||
do
|
||||
entry="${entry//\\\\:/:}"
|
||||
COMPREPLY[$i]=${entry}
|
||||
(( i++ ))
|
||||
done
|
||||
}
|
||||
|
||||
_nmcli_con_show()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue