diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-10-14 14:10:07 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-10-20 12:05:58 +0200 |
commit | ca599fad703523071fc460ca7c9df82f4897e341 (patch) | |
tree | 1f33bb45d3fe48f6553799f8c3c09474562d7571 | |
parent | 2d8a1ae56a0329efa6b4fcde5488e0cc01e56221 (diff) | |
download | NetworkManager-ca599fad703523071fc460ca7c9df82f4897e341.tar.gz |
nmcli: fix bash completion of words containing colon (rh #1271271)
Test:
$ sudo ip link add a:b: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 91dde2c865b551304999bf6e60deedf271823dd3)
-rw-r--r-- | clients/cli/nmcli-completion | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion index 9f34b83746..7bdd525585 100644 --- a/clients/cli/nmcli-completion +++ b/clients/cli/nmcli-completion @@ -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() |