summaryrefslogtreecommitdiff
path: root/shell-completion/zsh/_hostnamectl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-11 08:25:20 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-11 09:22:00 -0400
commit1ed774956406941d4812a3fb4493d2915f130f12 (patch)
treea9f7a8286351c2e94be2ec9a235dc63c105887d1 /shell-completion/zsh/_hostnamectl
parentdc5cd2b77288dc85c82cb95810cd14caee311e7e (diff)
shell-completion,man: beef up chassis completions and description
Parameters to hostnamectl command are not optional and should not be marked as such in the man page.
Diffstat (limited to 'shell-completion/zsh/_hostnamectl')
-rw-r--r--shell-completion/zsh/_hostnamectl32
1 files changed, 30 insertions, 2 deletions
diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl
index 7effa0489e..be8687609e 100644
--- a/shell-completion/zsh/_hostnamectl
+++ b/shell-completion/zsh/_hostnamectl
@@ -1,5 +1,30 @@
#compdef hostnamectl
+_hostnamectl_set-hostname() {
+ if (( CURRENT <= 3 )); then
+ _message "new hostname"
+ else
+ _message "no more options"
+ fi
+}
+
+_hostnamectl_set-icon-name() {
+ if (( CURRENT <= 3 )); then
+ _message "new icon name"
+ else
+ _message "no more options"
+ fi
+}
+
+_hostnamectl_set-chassis() {
+ if (( CURRENT <= 3 )); then
+ _chassis=( desktop laptop server tablet handset watch vm container )
+ _describe chassis _chassis
+ else
+ _message "no more options"
+ fi
+}
+
_hostnamectl_command() {
local -a _hostnamectl_cmds
_hostnamectl_cmds=(
@@ -14,8 +39,11 @@ _hostnamectl_command() {
local curcontext="$curcontext"
cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
if (( $#cmd )); then
- [[ $cmd == status ]] && msg="no options" || msg="options for $cmd"
- _message "$msg"
+ if [[ $cmd == status ]]; then
+ _message "no options"
+ else
+ _hostnamectl_$cmd
+ fi
else
_message "unknown hostnamectl command: $words[1]"
fi