]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_coredumpctl
shell-completion: replace "gdb" verb with "debug" for coredumpctl
[thirdparty/systemd.git] / shell-completion / zsh / _coredumpctl
CommitLineData
f4bab169 1#compdef coredumpctl
7059062c 2# SPDX-License-Identifier: LGPL-2.1+
70e104c4 3
f4bab169
LP
4_coredumpctl_command(){
5 local -a _coredumpctl_cmds
6 _coredumpctl_cmds=(
70e104c4 7 'list:List available coredumps'
720e0be0 8 'info:Show detailed information about one or more coredumps'
a217fdc9 9 'dump:Print coredump to stdout'
53956faf 10 'debug:Start debugger (gdb) on a coredump'
70e104c4
WG
11 )
12 if (( CURRENT == 1 )); then
f4bab169 13 _describe -t commands 'coredumpctl command' _coredumpctl_cmds
70e104c4
WG
14 else
15 local curcontext="$curcontext"
16 local -a _dumps
f4bab169 17 cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
70e104c4 18 if (( $#cmd )); then
a6e4952d 19 _dumps=( "${(f)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
70e104c4 20 if [[ -n "$_dumps" ]]; then
a6e4952d 21 _describe -V -t pids 'coredumps' _dumps
70e104c4
WG
22 else
23 _message "no coredumps"
24 fi
25 else
26 _message "no more options"
27 fi
28 fi
29}
30
31_arguments \
862f4963
WG
32 {-o+,--output=}'[Write output to FILE]:output file:_files' \
33 {-F+,--field=}'[Show field in list output]:field' \
720e0be0 34 '-1[Show information about most recent entry only]' \
15710d44
GS
35 {-S,--since}'[Print entries since the specified date]' \
36 {-U,--until}'[Print entries until the specified date]' \
5badf05f 37 {-r,--reverse}'[Show the newest entries first]' \
70e104c4 38 '--no-pager[Do not pipe output into a pager]' \
720e0be0 39 '--no-legend[Do not print the column headers]' \
70e104c4
WG
40 {-h,--help}'[Show this help]' \
41 '--version[Show package version]' \
53956faf 42 '--debugger=[Use the given debugger]' \
f4bab169 43 '*::coredumpctl commands:_coredumpctl_command'