cli: fix bash completion for nmcli connection modify

Only complete the setting name if it is at the very first
position after the connection.

e.g. complete the settings name in the case
  $ nmcli connection modify em1 connec<TAB>
but not at
  $ nmcli connection modify em1 connection.autoconnect <TAB>

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2013-10-30 13:33:32 +01:00
parent ba96409f72
commit 623f8a2be1

View file

@ -822,7 +822,9 @@ _nmcli()
words=("${words[@]:2}")
OPTIONS=(id uuid path apath)
_nmcli_complete_COMMAND_CONNECTION && return 0
_nmcli_list_nl "$(nmcli connection show configured "${COMMAND_CONNECTION_TYPE:-id}" "$COMMAND_CONNECTION_ID" 2>/dev/null | sed -n 's/^\([^:]\+\):.*/\1/p')"
if [[ ${#words[@]} -le 1 ]]; then
_nmcli_list_nl "$(nmcli connection show configured "${COMMAND_CONNECTION_TYPE:-id}" "$COMMAND_CONNECTION_ID" 2>/dev/null | sed -n 's/^\([^:]\+\):.*/\1/p')"
fi
fi
;;
de|del|dele|delet|delete)