_systemd-analyze revision fe05567c31cb88593a09ce5d8961d8b20627feb1
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas#compdef systemd-analyze
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek_systemd_analyze_set-log-level() {
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek local -a _levels
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek _levels=(debug info notice warning err crit alert emerg)
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek _describe -t level 'logging level' _levels || compadd "$@"
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek}
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas_systemd_analyze_command(){
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas local -a _systemd_analyze_cmds
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas # Descriptions taken from systemd-analyze --help.
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas _systemd_analyze_cmds=(
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas 'time:Print time spent in the kernel before reaching userspace'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas 'blame:Print list of running units ordered by time to init'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas 'critical-chain:Print a tree of the time critical chain of units'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas 'plot:Output SVG graphic showing service initialization'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas 'dot:Dump dependency graph (in dot(1) format)'
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek 'set-log-level:Set systemd log threshold'
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas )
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas if (( CURRENT == 1 )); then
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas _describe "options" _systemd_analyze_cmds
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas else
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek local curcontext="$curcontext"
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek cmd="${${_systemd_analyze_cmds[(r)$words[1]:*]%%:*}}"
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek if (( $#cmd )); then
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek if (( $+functions[_systemd_analyze_$cmd] )) && (( CURRENT == 2 )); then
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek _systemd_analyze_$cmd
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek else
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek _message "no more options"
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek fi
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek else
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek _message "unknown systemd-analyze command: $words[1]"
fe05567c31cb88593a09ce5d8961d8b20627feb1Zbigniew Jędrzejewski-Szmek fi
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas fi
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas}
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas_arguments \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas {-h,--help}'[Show help text.]' \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas '--user[Shows performance data of user sessions instead of the system manager.]' \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas '--order[When generating graph for dot, show only order]' \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas '--require[When generating graph for dot, show only requirement]' \
7abfbe7903d8e792850ec39286a3d86e616a6477William Giokas '*::systemd-analyze commands:_systemd_analyze_command'