summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-11-11 15:31:24 +0100
committerJiří Klimeš <jklimes@redhat.com>2013-11-13 12:19:51 +0100
commitce370fab64c5bee739e6f3ad91fac427da0de43d (patch)
treea5fce8923a75f38d32ca409f4cdc8417844b216f
parent79ac1cf08914d7e83c7fb3f7cde6974a4018d8c3 (diff)
downloadNetworkManager-ce370fab64c5bee739e6f3ad91fac427da0de43d.tar.gz
cli: add bash-completion for 'nmcli general hostname'
https://bugzilla.redhat.com/show_bug.cgi?id=1018510
-rw-r--r--cli/completion/nmcli11
1 files changed, 10 insertions, 1 deletions
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)