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