chiark / gitweb /
bus: when introspecting, turn unprivileged flag into inverse annoation of "privileged"
[elogind.git] / shell-completion / zsh / _systemd-analyze
1 #compdef systemd-analyze
2
3 _systemd_analyze_set-log-level() {
4     local -a _levels
5     _levels=(debug info notice warning err crit alert emerg)
6     _describe -t level 'logging level' _levels || compadd "$@"
7 }
8
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'
20     )
21
22     if (( CURRENT == 1 )); then
23         _describe "options" _systemd_analyze_cmds
24     else
25         local curcontext="$curcontext"
26         cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
27         if (( $#cmd )); then
28             if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
29                 _systemd_analyze_$cmd
30             else
31                 _message "no more options"
32             fi
33         else
34             _message "unknown systemd-analyze command: $words[1]"
35         fi
36     fi
37 }
38
39 _arguments \
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'