1 #compdef systemd-analyze
2 # SPDX-License-Identifier: LGPL-2.1+
4 _systemd_analyze_set-log-level() {
6 _levels=(debug info notice warning err crit alert emerg)
7 _describe -t level 'logging level' _levels || compadd "$@"
10 _systemd_analyze_set-log-target() {
12 _targets=(console journal kmsg journal-or-kmsg null)
13 _describe -t target 'logging target' _targets || compadd "$@"
16 _systemd_analyze_verify() {
20 _systemd_analyze_command(){
21 local -a _systemd_analyze_cmds
22 # Descriptions taken from systemd-analyze --help.
23 _systemd_analyze_cmds=(
24 'time:Print time spent in the kernel before reaching userspace'
25 'blame:Print list of running units ordered by time to init'
26 'critical-chain:Print a tree of the time critical chain of units'
27 'plot:Output SVG graphic showing service initialization'
28 'dot:Dump dependency graph (in dot(1) format)'
29 'dump:Dump server status'
30 'set-log-level:Set systemd log threshold'
31 'set-log-target:Set systemd log target'
32 'get-log-level:Get systemd log threshold'
33 'get-log-target:Get systemd log target'
34 'syscall-filter:List syscalls in seccomp filter'
35 'verify:Check unit files for correctness'
38 if (( CURRENT == 1 )); then
39 _describe "options" _systemd_analyze_cmds
41 local curcontext="$curcontext"
42 cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
44 if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
47 _message "no more options"
50 _message "unknown systemd-analyze command: $words[1]"
56 {-h,--help}'[Show help text]' \
57 '--version[Show package version]' \
58 '--system[Operate on system systemd instance]' \
59 '--user[Operate on user systemd instance]' \
60 '--no-pager[Do not pipe output into a pager]' \
61 '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
62 '--order[When generating graph for dot, show only order]' \
63 '--require[When generating graph for dot, show only requirement]' \
64 '--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \
65 '--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
66 '--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
67 {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
68 {-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
69 '*::systemd-analyze commands:_systemd_analyze_command'