From ce370fab64c5bee739e6f3ad91fac427da0de43d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 11 Nov 2013 15:31:24 +0100 Subject: [PATCH] cli: add bash-completion for 'nmcli general hostname' https://bugzilla.redhat.com/show_bug.cgi?id=1018510 --- cli/completion/nmcli | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/completion/nmcli b/cli/completion/nmcli index 9eabc213e3..9f427ee10f 100644 --- a/cli/completion/nmcli +++ b/cli/completion/nmcli @@ -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)