]>
Commit | Line | Data |
---|---|---|
db456cd0 WG |
1 | #compdef hostnamectl |
2 | ||
db456cd0 WG |
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 | ) | |
10 | if (( CURRENT == 1 )); then | |
11 | _describe -t commands 'hostnamectl commands' _hostnamectl_cmds || compadd "$@" | |
12 | else | |
13 | local curcontext="$curcontext" | |
14 | cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}" | |
15 | if (( $#cmd )); then | |
16 | [[ $cmd == status ]] && msg="no options" || msg="options for $cmd" | |
17 | _message "$msg" | |
18 | else | |
19 | _message "unknown hostnamectl command: $words[1]" | |
20 | fi | |
21 | fi | |
22 | } | |
23 | ||
24 | _arguments -s \ | |
25 | {-h,--help}'[Show this help]' \ | |
26 | '--version[Show package version]' \ | |
27 | '--transient[Only set transient hostname]' \ | |
28 | '--static[Only set static hostname]' \ | |
29 | '--pretty[Only set pretty hostname]' \ | |
30 | '--no-ask-password[Do not prompt for password]' \ | |
862f4963 | 31 | {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ |
db456cd0 | 32 | '*::hostnamectl commands:_hostnamectl_command' |