cli: change completion to suggest connection ids
Before, whereever a connection id is accepted, the completion only offered 'id', 'uuid', 'path', etc. With this change, it will additionally suggest the id of existing connections. https://bugzilla.redhat.com/show_bug.cgi?id=997997 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -18,6 +18,11 @@ _nmcli_con_id()
|
|||||||
echo "$(nmcli -t -f NAME con show c 2>/dev/null)"
|
echo "$(nmcli -t -f NAME con show c 2>/dev/null)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_nmcli_con_id_active()
|
||||||
|
{
|
||||||
|
echo "$(nmcli -t -f NAME con show a 2>/dev/null)"
|
||||||
|
}
|
||||||
|
|
||||||
_nmcli_con_uuid()
|
_nmcli_con_uuid()
|
||||||
{
|
{
|
||||||
echo "$(nmcli -t -f UUID con show c 2>/dev/null)"
|
echo "$(nmcli -t -f UUID con show c 2>/dev/null)"
|
||||||
@@ -301,11 +306,11 @@ _nmcli()
|
|||||||
if [[ ${#words[@]} -gt 3 ]]; then
|
if [[ ${#words[@]} -gt 3 ]]; then
|
||||||
case $subcommand in
|
case $subcommand in
|
||||||
c|co|con|conf|confi|config|configu|configur|configure|configured)
|
c|co|con|conf|confi|config|configu|configur|configure|configured)
|
||||||
_nmcli_list "id uuid path"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
a|ac|act|acti|activ|active)
|
a|ac|act|acti|activ|active)
|
||||||
_nmcli_list "id uuid path apath"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\napath\n%s" "$(_nmcli_con_id_active)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -318,12 +323,12 @@ _nmcli()
|
|||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
_nmcli_list "--nowait --timeout"
|
_nmcli_list "--nowait --timeout"
|
||||||
else
|
else
|
||||||
_nmcli_list "id uuid path iface ap nsp"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\niface\nap\nnsp\n%s" "$(_nmcli_con_id)")"
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
d|do|dow|down)
|
d|do|dow|down)
|
||||||
_nmcli_list "id uuid path apath"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\napath\n%s" "$(_nmcli_con_id_active)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
a|ad|add)
|
a|ad|add)
|
||||||
@@ -331,15 +336,15 @@ _nmcli()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
e|ed|edi|edit)
|
e|ed|edi|edit)
|
||||||
_nmcli_list "id uuid path type con-name"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\ntype\n%s" "$(_nmcli_con_id)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
m|mo|mod|modi|modif|modify)
|
m|mo|mod|modi|modif|modify)
|
||||||
_nmcli_list_nl "$(_nmcli_con_id)"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
de|del|dele|delet|delete)
|
de|del|dele|delet|delete)
|
||||||
_nmcli_list "id uuid path"
|
_nmcli_list_nl "$(printf "id\nuuid\npath\n%s" "$(_nmcli_con_id)")"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user