chiark / gitweb /
macro: add DISABLE_WARNING_SHADOW
[elogind.git] / shell-completion / zsh / _hostnamectl
1 #compdef hostnamectl
2
3 _hostnamectl_command() {
4     local -a _hostnamectl_cmds
5     _hostnamectl_cmds=(
6         "status:Show current hostname settings"
7         "set-hostname:Set system hostname"
8         "set-icon-name:Set icon name for host"
9         "set-chassis:Set chassis type for host"
10     )
11     if (( CURRENT == 1 )); then
12         _describe -t commands 'hostnamectl commands' _hostnamectl_cmds || compadd "$@"
13     else
14         local curcontext="$curcontext"
15         cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
16         if (( $#cmd )); then
17             [[ $cmd == status ]] && msg="no options" || msg="options for $cmd"
18             _message "$msg"
19         else
20             _message "unknown hostnamectl command: $words[1]"
21         fi
22     fi
23 }
24
25 _arguments -s \
26     {-h,--help}'[Show this help]' \
27     '--version[Show package version]' \
28     '--transient[Only set transient hostname]' \
29     '--static[Only set static hostname]' \
30     '--pretty[Only set pretty hostname]' \
31     '--no-ask-password[Do not prompt for password]' \
32     {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
33     '*::hostnamectl commands:_hostnamectl_command'