]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_systemd
zsh_completion: Split out zsh _systemd-analyze
[thirdparty/systemd.git] / shell-completion / zsh / _systemd
1 #compdef systemd-cat systemd-ask-password systemd-cgls systemd-cgtop systemd-delta systemd-detect-virt systemd-machine-id-setup systemd-notify systemd-tmpfiles systemd-tty-ask-password-agent machinectl
2
3 _ctls()
4 {
5 local curcontext="$curcontext" state lstate line
6 case "$service" in
7 systemd-ask-password)
8 _arguments \
9 {-h,--help}'[Show this help]' \
10 '--icon=[Icon name]' \
11 '--timeout=[Timeout in sec]' \
12 '--no-tty[Ask question via agent even on TTY]' \
13 '--accept-cached[Accept cached passwords]' \
14 '--multiple[List multiple passwords if available]'
15 ;;
16 systemd-cat)
17 _arguments \
18 {-h,--help}'[Show this help]' \
19 '--version[Show package version.]' \
20 {-t,--identifier=}'[Set syslog identifier.]' \
21 {-p,--priority=}'[Set priority value.]:value:({0..7})' \
22 '--level-prefix=[Control whether level prefix shall be parsed.]:boolean:(1 0)' \
23 ':Message'
24 ;;
25 systemd-cgls)
26 _arguments \
27 {-h,--help}'[Show this help]' \
28 '--version[Show package version]' \
29 '--no-pager[Do not pipe output into a pager]' \
30 {-a,--all}'[Show all groups, including empty]' \
31 '-k[Include kernel threads in output]' \
32 ':cgroups:(cpuset cpu cpuacct memory devices freezer net_cls blkio)'
33 ;;
34 systemd-cgtop)
35 _arguments \
36 {-h,--help}'[Show this help]' \
37 '--version[Print version and exit]' \
38 '(-c -m -i -t)-p[Order by path]' \
39 '(-c -p -m -i)-t[Order by number of tasks]' \
40 '(-m -p -i -t)-c[Order by CPU load]' \
41 '(-c -p -i -t)-m[Order by memory load]' \
42 '(-c -m -p -t)-i[Order by IO load]' \
43 {-d,--delay=}'[Specify delay]' \
44 {-n,--iterations=}'[Run for N iterations before exiting]' \
45 {-b,--batch}'[Run in batch mode, accepting no input]' \
46 '--depth=[Maximum traversal depth]'
47 ;;
48 systemd-delta)
49 _arguments \
50 {-h,--help}'[Show this help]' \
51 '--version[Show package version]' \
52 '--no-pager[Do not pipe output into a pager]' \
53 '--diff=[Show a diff when overridden files differ]:boolean:(1 0)' \
54 {-t,--type=}'[Only display a selected set of override types]:types:(masked equivalent redirected overridden unchanged)' \
55 ':SUFFIX:(tmpfiles.d sysctl.d systemd/system)'
56 ;;
57 systemd-detect-virt)
58 _arguments \
59 {-h,--help}'[Show this help]' \
60 '--version[Show package version]' \
61 {-c,--container}'[Only detect whether we are run in a container]' \
62 {-v,--vm}'[Only detect whether we are run in a VM]' \
63 {-q,--quiet}"[Don't output anything, just set return value]"
64 ;;
65 systemd-machine-id-setup)
66 _arguments \
67 {-h,--help}'[Show this help]' \
68 '--version[Show package version]'
69 ;;
70 systemd-notify)
71 _arguments \
72 {-h,--help}'[Show this help]' \
73 '--version[Show package version]' \
74 '--ready[Inform the init system about service start-up completion.]' \
75 '--pid=[Inform the init system about the main PID of the daemon]' \
76 '--status=[Send a free-form status string for the daemon to the init systemd]' \
77 '--booted[Returns 0 if the system was booted up with systemd]' \
78 '--readahead=[Controls disk read-ahead operations]:arguments:(cancel done noreply)'
79 ;;
80 systemd-tmpfiles)
81 _arguments \
82 '--create[Create, set ownership/permissions based on the config files.]' \
83 '--clean[Clean up all files and directories with an age parameter configured.]' \
84 '--remove[All files and directories marked with r, R in the configuration files are removed.]' \
85 '--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
86 '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
87 '--help[Prints a short help text and exits.]' \
88 '*::files:_files'
89 ;;
90 systemd-tty-ask-password-agent)
91 _arguments \
92 {-h,--help}'[Prints a short help text and exits.]' \
93 '--version[Prints a short version string and exits.]' \
94 '--list[Lists all currently pending system password requests.]' \
95 '--query[Process all currently pending system password requests by querying the user on the calling TTY.]' \
96 '--watch[Continuously process password requests.]' \
97 '--wall[Forward password requests to wall(1).]' \
98 '--plymouth[Ask question with plymouth(8).]' \
99 '--console[Ask question on /dev/console.]'
100 ;;
101 machinectl)
102 _arguments \
103 {-h,--help}'[Prints a short help text and exits.]' \
104 '--version[Prints a short version string and exits.]' \
105 {-p,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
106 {-a,--all}'[Show all proerties]' \
107 (-l,--full)'[Do not ellipsize cgroup members]' \
108 '--no-pager[Do not pipe output into a pager]' \
109 '--no-ask-password[Do not ask for system passwords]' \
110 '--kill-who=[Who to send signal to]:killwho:(leader all)' \
111 {-s,--signal=}'[Which signal to send]:signal:_signals' \
112 {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
113 {-P,--privileged}'[Acquire privileges before execution]' \
114 '*::machinectl command:_machinectl_command'
115 ;;
116 *) _message 'eh?' ;;
117 esac
118 }
119
120 _hosts_or_user_at_host()
121 {
122 _alternative \
123 'users-hosts:: _user_at_host' \
124 'hosts:: _hosts'
125 }
126
127 _outputmodes() {
128 local -a _output_opts
129 _output_opts=(short short-monotonic verbose export json json-pretty json-see cat)
130 _describe -t output 'output mode' _output_opts || compadd "$@"
131 }
132
133 (( $+functions[_machinectl_command] )) || _machinectl_command()
134 {
135 local -a _machinectl_cmds
136 _machinectl_cmds=(
137 "list:List currently running VMs/containers"
138 "status:Show VM/container status"
139 "show:Show properties of one or more VMs/containers"
140 "terminate:Terminate one or more VMs/containers"
141 "kill:Send signal to process or a VM/container"
142 )
143 if (( CURRENT == 1 )); then
144 _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
145 else
146 local curcontext="$curcontext"
147 cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
148 if (( $#cmd )); then
149 case $cmd in
150 list) msg="no options" ;;
151 *)
152 _machines=( "${(foa)$(machinectl list | awk '{print $1}')}" )
153 if [[ -n "$_machines" ]]; then
154 _describe 'machines' _machines
155 else
156 _message 'no machines'
157 fi
158 esac
159 else
160 _message "no more options"
161 fi
162 fi
163 }
164
165 _ctls "$@"
166
167 #vim: set ft=zsh sw=4 ts=4 et