]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_systemd-analyze
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / shell-completion / zsh / _systemd-analyze
1 #compdef systemd-analyze
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 _systemd_analyze_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
10 _systemd_analyze_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
16 _systemd_analyze_verify() {
17 _sd_unit_files
18 }
19
20 _systemd_analyze_service-watchdogs() {
21 local -a _states
22 _states=(on off)
23 _describe -t state 'state' _states || compadd "$@"
24 }
25
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)'
35 'dump:Dump server status'
36 'unit-paths:List unit load paths'
37 'log-level:Get/set systemd log threshold'
38 'log-target:Get/set systemd log target'
39 'service-watchdogs:Get/set service watchdog status'
40 'syscall-filter:List syscalls in seccomp filter'
41 'verify:Check unit files for correctness'
42 'calendar:Validate repetitive calendar time events'
43 )
44
45 if (( CURRENT == 1 )); then
46 _describe "options" _systemd_analyze_cmds
47 else
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
59 fi
60 }
61
62 _arguments \
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 '--global[Show global user instance config]' \
68 '--no-pager[Do not pipe output into a pager]' \
69 '--man=[Do (not) check for existence of man pages]:boolean:(1 0)' \
70 '--order[When generating graph for dot, show only order]' \
71 '--require[When generating graph for dot, show only requirement]' \
72 '--fuzz=[When printing the tree of the critical chain, print also services, which finished TIMESPAN earlier, than the latest in the branch]:TIMESPAN' \
73 '--from-pattern=[When generating a dependency graph, filter only origins]:GLOB' \
74 '--to-pattern=[When generating a dependency graph, filter only destinations]:GLOB' \
75 {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
76 {-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \
77 '*::systemd-analyze commands:_systemd_analyze_command'