chiark / gitweb /
treewide: fix multiple typos
[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_verify() {
10     _sd_unit_files
11 }
12
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'
25     )
26
27     if (( CURRENT == 1 )); then
28         _describe "options" _systemd_analyze_cmds
29     else
30         local curcontext="$curcontext"
31         cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
32         if (( $#cmd )); then
33             if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
34                 _systemd_analyze_$cmd
35             else
36                 _message "no more options"
37             fi
38         else
39             _message "unknown systemd-analyze command: $words[1]"
40         fi
41     fi
42 }
43
44 _arguments \
45     {-h,--help}'[Show help text]' \
46     '--version[Show package version]' \
47     '--system[Operate on system systemd instance]' \
48     '--user[Operate on user systemd instance]' \
49     '--no-pager[Do not pipe output into a pager]' \
50     '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
51     '--order[When generating graph for dot, show only order]' \
52     '--require[When generating graph for dot, show only requirement]' \
53     '--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \
54     '--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
55     '--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
56     {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
57     {-M+,--machine=}'[Operate on local container]:machine' \
58     '*::systemd-analyze commands:_systemd_analyze_command'