]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_hostnamectl
coredumpctl: add more debug output
[thirdparty/systemd.git] / shell-completion / zsh / _hostnamectl
CommitLineData
db456cd0
WG
1#compdef hostnamectl
2
3_hosts_or_user_at_host() {
4 _alternative \
5 'users-hosts:: _user_at_host' \
6 'hosts:: _hosts'
7}
8
9_hostnamectl_command() {
10 local -a _hostnamectl_cmds
11 _hostnamectl_cmds=(
12 "status:Show current hostname settings"
13 "set-hostname:Set system hostname"
14 "set-icon-name:Set icon name for host"
15 )
16 if (( CURRENT == 1 )); then
17 _describe -t commands 'hostnamectl commands' _hostnamectl_cmds || compadd "$@"
18 else
19 local curcontext="$curcontext"
20 cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
21 if (( $#cmd )); then
22 [[ $cmd == status ]] && msg="no options" || msg="options for $cmd"
23 _message "$msg"
24 else
25 _message "unknown hostnamectl command: $words[1]"
26 fi
27 fi
28}
29
30_arguments -s \
31 {-h,--help}'[Show this help]' \
32 '--version[Show package version]' \
33 '--transient[Only set transient hostname]' \
34 '--static[Only set static hostname]' \
35 '--pretty[Only set pretty hostname]' \
36 '--no-ask-password[Do not prompt for password]' \
37 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
38 '*::hostnamectl commands:_hostnamectl_command'