cli: make bash-completion for nmcli support more abbreviations.
Also sub commands can be abbreviated. Add some more aliases to the bash completion. Also fix the option 'nmcli radio mobile' which is called 'wwan'. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -172,59 +172,68 @@ _nmcli()
|
||||
|
||||
case $object in
|
||||
g|ge|gen|gene|gener|genera|general)
|
||||
if [[ ${#words[@]} -gt 3 ]]; then
|
||||
case $command in
|
||||
status | permissions)
|
||||
s|st|sta|stat|statu|status | p|pe|per|perm|permi|permis|permiss|permissi|permissio|permission|permissions)
|
||||
return 0
|
||||
;;
|
||||
logging)
|
||||
l|lo|log|logg|loggi|loggin|logging)
|
||||
_nmcli_list "level domains"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_nmcli_list "status permissions logging help"
|
||||
;;
|
||||
|
||||
n|ne|net|netw|netwo|networ|network|networki|networkin|networking)
|
||||
if [[ ${#words[@]} -gt 3 ]]; then
|
||||
case $command in
|
||||
on | off)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
_nmcli_list "on off help"
|
||||
;;
|
||||
|
||||
r|ra|rad|radi|radio)
|
||||
if [[ ${#words[@]} -gt 3 ]]; then
|
||||
case $command in
|
||||
all | wifi | mobile | wimax)
|
||||
a|al|all | w|wi|wif|wifi | ww|wwa|wwan | wim|wima|wimax)
|
||||
_nmcli_list "on off"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_nmcli_list "all wifi mobile wimax help"
|
||||
_nmcli_list "all wifi wwan wimax help"
|
||||
;;
|
||||
|
||||
c|co|con|conn|conne|connec|connect|connecti|connectio|connection)
|
||||
if [[ ${#words[@]} -gt 3 ]]; then
|
||||
case $command in
|
||||
show)
|
||||
s|sh|sho|show)
|
||||
local subcommand=${words[3]}
|
||||
|
||||
if [[ ${#words[@]} -gt 4 ]]; then
|
||||
case $subcommand in
|
||||
configured)
|
||||
c|co|con|conf|confi|config|configu|configur|configure|configured)
|
||||
_nmcli_list "id uuid path"
|
||||
return 0
|
||||
;;
|
||||
active)
|
||||
a|ac|act|acti|activ|active)
|
||||
_nmcli_list "id uuid path apath"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_nmcli_list "configured active"
|
||||
return 0
|
||||
;;
|
||||
up)
|
||||
u|up)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_nmcli_list "--nowait --timeout"
|
||||
else
|
||||
@@ -232,38 +241,39 @@ _nmcli()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
down)
|
||||
d|do|dow|down)
|
||||
_nmcli_list "id uuid path apath"
|
||||
return 0
|
||||
;;
|
||||
add)
|
||||
a|ad|add)
|
||||
_nmcli_list "type con-name autoconnect ifname help"
|
||||
return 0
|
||||
;;
|
||||
edit)
|
||||
e|ed|edi|edit)
|
||||
_nmcli_list "id uuid path type con-name"
|
||||
return 0
|
||||
;;
|
||||
modify)
|
||||
m|mo|mod|modi|modif|modify)
|
||||
_nmcli_list_nl "$(_nmcli_con_id)"
|
||||
return 0
|
||||
;;
|
||||
delete)
|
||||
de|del|dele|delet|delete)
|
||||
_nmcli_list "id uuid path"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
_nmcli_list "show up down add modify edit delete reload help"
|
||||
;;
|
||||
|
||||
d|de|dev|devi|devic|device)
|
||||
if [[ ${#words[@]} -gt 3 ]]; then
|
||||
case $command in
|
||||
show)
|
||||
sh|sho|show)
|
||||
_nmcli_list_nl "$(_nmcli_NM_devices)"
|
||||
return 0
|
||||
;;
|
||||
disconnect)
|
||||
d|di|dis|disc|disco|discon|disconn|disconne|disconnec|disconnect)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_nmcli_list "--nowait --timeout"
|
||||
else
|
||||
@@ -271,15 +281,15 @@ _nmcli()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
wifi)
|
||||
w|wi|wif|wifi)
|
||||
local subcommand=${words[3]}
|
||||
|
||||
case $subcommand in
|
||||
list)
|
||||
l|li|lis|list)
|
||||
_nmcli_list "iface bssid"
|
||||
return 0
|
||||
;;
|
||||
connect)
|
||||
c|co|con|conn|conne|connec|connect)
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_nmcli_list "--private --nowait --timeout"
|
||||
else
|
||||
@@ -291,7 +301,7 @@ _nmcli()
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
scan)
|
||||
r|re|res|resc|resca|rescan)
|
||||
if [[ "$cur" == i* ]]; then
|
||||
_nmcli_list "iface"
|
||||
else
|
||||
@@ -304,21 +314,24 @@ _nmcli()
|
||||
_nmcli_list "list connect scan"
|
||||
return 0
|
||||
;;
|
||||
wimax)
|
||||
wim|wima|wimax)
|
||||
local subcommand=${words[3]}
|
||||
|
||||
if [[ ${#words[@]} -gt 4 ]]; then
|
||||
case $subcommand in
|
||||
list)
|
||||
l|li|lis|list)
|
||||
_nmcli_list "iface nsp"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
_nmcli_list "list"
|
||||
return 0
|
||||
;;
|
||||
|
||||
esac
|
||||
fi
|
||||
|
||||
_nmcli_list "status show disconnect wifi wimax help"
|
||||
;;
|
||||
|
Reference in New Issue
Block a user