cli: add bash-completion for 'nmcli general hostname'

https://bugzilla.redhat.com/show_bug.cgi?id=1018510
This commit is contained in:
Thomas Haller 2013-11-11 15:31:24 +01:00 committed by Jiří Klimeš
parent 79ac1cf089
commit ce370fab64

View file

@ -555,9 +555,18 @@ _nmcli()
;;
g|ge|gen|gene|gener|genera|general)
if [[ ${#words[@]} -eq 2 ]]; then
_nmcli_complete_commands "$command" status permissions logging
_nmcli_complete_commands "$command" status permissions logging hostname
elif [[ ${#words[@]} -gt 2 ]]; then
case "$command" in
ho|hos|host|hostn|hostna|hostnam|hostname)
if [[ ${#words[@]} -eq 3 ]]; then
_nmcli_list_nl "$(printf '%s\n%s\n%s\n' \
"$(nmcli general hostname 2>/dev/null)" \
"$(cat /etc/hostname 2>/dev/null)" \
"$(hostnamectl status 2>/dev/null | sed -n '1s/^.\+hostname: \(.\+\)$/\1/p')" \
"$HOSTNAME")"
fi
;;
l|lo|log|logg|loggi|loggin|logging)
words=("${words[@]:2}")
OPTIONS=(level domains)