cli: option autocompletion should not match words without trailing '-'

This would fix for example:
nmcli e <TAB>
(e interpreted as --escape, would allow autocompletion to work... but
when the command is executed an error is reported)

Moreover, we will now have:
nmcli c <TAB>
autocompletion work correctly, i.e., c is correctly interpreted  as
"connection" instead of "--colors"
This commit is contained in:
Francesco Giudici
2016-06-28 12:12:39 +02:00
parent fd4a8a202e
commit fdecb6b669

View File

@@ -123,6 +123,8 @@ _nmcli_compl_match_option()
S="${S:2}"
elif [[ "${S:0:1}" == "-" ]]; then
S="${S:1}"
else
return 1
fi
for V; do
case "$V" in