]>
Commit | Line | Data |
---|---|---|
7abfbe79 | 1 | #compdef systemd-analyze |
7059062c | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
7abfbe79 | 3 | |
fe05567c ZJS |
4 | _systemd_analyze_set-log-level() { |
5 | local -a _levels | |
6 | _levels=(debug info notice warning err crit alert emerg) | |
7 | _describe -t level 'logging level' _levels || compadd "$@" | |
8 | } | |
9 | ||
4146ac2a LW |
10 | _systemd_analyze_set-log-target() { |
11 | local -a _targets | |
12 | _targets=(console journal kmsg journal-or-kmsg null) | |
13 | _describe -t target 'logging target' _targets || compadd "$@" | |
14 | } | |
15 | ||
2c12a402 ZJS |
16 | _systemd_analyze_verify() { |
17 | _sd_unit_files | |
18 | } | |
19 | ||
dba081db ZJS |
20 | _systemd_analyze_service-watchdogs() { |
21 | local -a _states | |
22 | _states=(on off) | |
23 | _describe -t state 'state' _states || compadd "$@" | |
24 | } | |
25 | ||
7abfbe79 WG |
26 | _systemd_analyze_command(){ |
27 | local -a _systemd_analyze_cmds | |
28 | # Descriptions taken from systemd-analyze --help. | |
29 | _systemd_analyze_cmds=( | |
30 | 'time:Print time spent in the kernel before reaching userspace' | |
31 | 'blame:Print list of running units ordered by time to init' | |
32 | 'critical-chain:Print a tree of the time critical chain of units' | |
33 | 'plot:Output SVG graphic showing service initialization' | |
34 | 'dot:Dump dependency graph (in dot(1) format)' | |
299c397c | 35 | 'dump:Dump server status' |
fe05567c | 36 | 'set-log-level:Set systemd log threshold' |
4146ac2a | 37 | 'set-log-target:Set systemd log target' |
ef5a8cb1 LW |
38 | 'get-log-level:Get systemd log threshold' |
39 | 'get-log-target:Get systemd log target' | |
dba081db | 40 | 'service-watchdogs:Get/set service watchdog status' |
869feb33 | 41 | 'syscall-filter:List syscalls in seccomp filter' |
2c12a402 | 42 | 'verify:Check unit files for correctness' |
7abfbe79 WG |
43 | ) |
44 | ||
45 | if (( CURRENT == 1 )); then | |
46 | _describe "options" _systemd_analyze_cmds | |
47 | else | |
fe05567c ZJS |
48 | local curcontext="$curcontext" |
49 | cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}" | |
50 | if (( $#cmd )); then | |
51 | if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then | |
52 | _systemd_analyze_$cmd | |
53 | else | |
54 | _message "no more options" | |
55 | fi | |
56 | else | |
57 | _message "unknown systemd-analyze command: $words[1]" | |
58 | fi | |
7abfbe79 WG |
59 | fi |
60 | } | |
61 | ||
62 | _arguments \ | |
26bd71f0 RC |
63 | {-h,--help}'[Show help text]' \ |
64 | '--version[Show package version]' \ | |
65 | '--system[Operate on system systemd instance]' \ | |
66 | '--user[Operate on user systemd instance]' \ | |
67 | '--no-pager[Do not pipe output into a pager]' \ | |
cc98b302 | 68 | '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \ |
7abfbe79 WG |
69 | '--order[When generating graph for dot, show only order]' \ |
70 | '--require[When generating graph for dot, show only requirement]' \ | |
26bd71f0 RC |
71 | '--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \ |
72 | '--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \ | |
73 | '--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \ | |
2c12a402 | 74 | {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ |
b93f15cd | 75 | {-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \ |
7abfbe79 | 76 | '*::systemd-analyze commands:_systemd_analyze_command' |