From bbfd1029d8ee30996f0e252d76a08c8ff39a5be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Wed, 14 Oct 2015 14:10:07 +0200 Subject: nmcli: fix bash completion of words containing colon (rh #1271271) Test: $ sudo ip link add a:b:c type dummy $ nmcli device delete $ nmcli device delete a 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 https://bugzilla.redhat.com/show_bug.cgi?id=1271271 --- clients/cli/nmcli-completion | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion index 927d01709b..6d9b6ae1cb 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() -- cgit v1.2.1