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_command(){
10 local -a _systemd_analyze_cmds
11 # Descriptions taken from systemd-analyze --help.
12 _systemd_analyze_cmds=(
13 'time:Print time spent in the kernel before reaching userspace'
14 'blame:Print list of running units ordered by time to init'
15 'critical-chain:Print a tree of the time critical chain of units'
16 'plot:Output SVG graphic showing service initialization'
17 'dot:Dump dependency graph (in dot(1) format)'
18 'dump:Dump server status'
19 'set-log-level:Set systemd log threshold'
22 if (( CURRENT == 1 )); then
23 _describe "options" _systemd_analyze_cmds
25 local curcontext="$curcontext"
26 cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
28 if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
31 _message "no more options"
34 _message "unknown systemd-analyze command: $words[1]"
40 {-h,--help}'[Show help text.]' \
41 '--user[Shows performance data of user sessions instead of the system manager.]' \
42 '--order[When generating graph for dot, show only order]' \
43 '--require[When generating graph for dot, show only requirement]' \
44 '*::systemd-analyze commands:_systemd_analyze_command'