1 #compdef systemd-analyze
3 _systemd_analyze_set-log-level() {
5 _levels=(debug info notice warning err crit alert emerg)
6 _describe -t level 'logging level' _levels || compadd "$@"
9 _systemd_analyze_verify() {
13 _systemd_analyze_command(){
14 local -a _systemd_analyze_cmds
15 # Descriptions taken from systemd-analyze --help.
16 _systemd_analyze_cmds=(
17 'time:Print time spent in the kernel before reaching userspace'
18 'blame:Print list of running units ordered by time to init'
19 'critical-chain:Print a tree of the time critical chain of units'
20 'plot:Output SVG graphic showing service initialization'
21 'dot:Dump dependency graph (in dot(1) format)'
22 'dump:Dump server status'
23 'set-log-level:Set systemd log threshold'
24 'verify:Check unit files for correctness'
27 if (( CURRENT == 1 )); then
28 _describe "options" _systemd_analyze_cmds
30 local curcontext="$curcontext"
31 cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
33 if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
36 _message "no more options"
39 _message "unknown systemd-analyze command: $words[1]"
45 {-h,--help}'[Show help text.]' \
46 '--system[Operate on system systemd instance.]' \
47 '--user[Operate on user systemd instance.]' \
48 '--no-pager[Do not user pager.]' \
49 '--no-man[Do not check man pages.]' \
50 '--order[When generating graph for dot, show only order]' \
51 '--require[When generating graph for dot, show only requirement]' \
52 {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
53 {-M+,--machine=}'[Operate on local container]:machine' \
54 '*::systemd-analyze commands:_systemd_analyze_command'