]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_timedatectl
coredumpctl: add more debug output
[thirdparty/systemd.git] / shell-completion / zsh / _timedatectl
CommitLineData
20c8382b
WG
1#compdef timedatectl
2
3_timedatectl_set-timezone(){
4 local -a _timezones
5 _timezones=( ${(f)"$(_call_program timezones "${service}" list-timezones)"} )
6 compadd "$_timezones[@]"
7}
8
9_timedatectl_set-time(){
10 _message "YYYY-MM-DD HH:MM:SS"
11}
12
13_timedatectl_set-local-rtc(){
14 local -a _options
15 _options=(
16 '0:Maintain RTC in universal time'
17 '1:Maintain RTC in local time'
18 )
19 _describe options _options
20}
21
22_timedatectl_set-ntp(){
23 local -a _options
24 _options=(
25 '0:Disable NTP based network time configuration'
26 '1:Enable NTP based network time configuration'
27 )
28 _describe options _options
29}
30
31_timedatectl_command(){
32 local -a _timedatectl_cmds
33 _timedatectl_cmds=(
34 'status:Show current time settings'
35 'set-time:Set system time'
36 'set-timezone:Set system timezone'
37 'list-timezones:Show known timezones'
38 'set-local-rtc:Control whether RTC is in local time'
39 'set-ntp:Control whether NTP is enabled'
40 )
41 if (( CURRENT == 1 )); then
42 _describe -t commands 'timedatectl command' _timedatectl_cmds
43 else
44 local curcontext="$curcontext"
45 cmd="${${_timedatectl_cmds[(r)$words[1]:*]%%:*}}"
46 if (( $#cmd )); then
47 if (( $+functions[_timedatectl_$cmd] )); then
48 _timedatectl_$cmd
49 else
50 _message "no more options"
51 fi
52 else
53 _message "unknown timedatectl command: $words[1]"
54 fi
55 fi
56}
57
58_hosts_or_user_at_host() {
59 _alternative \
60 'users-hosts:: _user_at_host' \
61 'hosts:: _hosts'
62}
63
64_arguments -s \
65 {-h,--help}'[Show this help]' \
66 '--version[Show package version]' \
67 '--adjust-system-clock[Adjust system clock when changing local RTC mode]' \
68 '--no-pager[Do not pipe output into a pager]' \
69 '--no-ask-password[Do not prompt for password]' \
70 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
71 '*::timedatectl commands:_timedatectl_command'