cli/bash-completion: only complete active connections for nmcli con down

Only complete the ids/uuids for active connections in
`nmcli connection down <type> <TAB>`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-01-10 01:01:31 +01:00 committed by Jiří Klimeš
parent 8c659b79ed
commit b4d9958b76

View file

@ -437,17 +437,21 @@ _nmcli_complete_COMMAND_CONNECTION()
fi
COMMAND_CONNECTION_TYPE="${words[0]}"
COMMAND_CONNECTION_ID="${words[1]}"
local CON_TYPE=configured
if [[ "x$COMMAND_CONNECTION_ACTIVE" != x ]]; then
CON_TYPE=active
fi
case "${words[0]}" in
id)
if [[ ${#words[@]} -eq 2 ]]; then
_nmcli_list_nl "$(_nmcli_con_show NAME configured)"
_nmcli_list_nl "$(_nmcli_con_show NAME $CON_TYPE)"
return 0
fi
words=("${words[@]:2}")
;;
uuid)
if [[ ${#words[@]} -eq 2 ]]; then
_nmcli_list_nl "$(_nmcli_con_show UUID configured)"
_nmcli_list_nl "$(_nmcli_con_show UUID $CON_TYPE)"
return 0
fi
words=("${words[@]:2}")
@ -622,6 +626,7 @@ _nmcli()
elif [[ ${#words[@]} -gt 3 ]]; then
words=("${words[@]:2}")
OPTIONS=(id uuid path apath)
local COMMAND_CONNECTION_ACTIVE=1
_nmcli_complete_COMMAND_CONNECTION
fi
;;