mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 18:40:16 +01:00
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:
parent
8c659b79ed
commit
b4d9958b76
1 changed files with 7 additions and 2 deletions
|
|
@ -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
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue