3 _coredumpctl_command(){
4 local -a _coredumpctl_cmds
6 'list:List available coredumps'
7 'info:Show detailed information about one or more coredumps'
8 'dump:Print coredump to stdout'
9 'gdb:Start gdb on a coredump'
11 if (( CURRENT == 1 )); then
12 _describe -t commands 'coredumpctl command' _coredumpctl_cmds
14 local curcontext="$curcontext"
16 cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
18 # user can set zstyle ':completion:*:*:coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
19 _dumps=( "${(foa)$(coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
20 if [[ -n "$_dumps" ]]; then
21 _describe -t pids 'coredumps' _dumps
23 _message "no coredumps"
26 _message "no more options"
32 {-o+,--output=}'[Write output to FILE]:output file:_files' \
33 {-F+,--field=}'[Show field in list output]:field' \
34 '-1[Show information about most recent entry only]' \
35 '--no-pager[Do not pipe output into a pager]' \
36 '--no-legend[Do not print the column headers]' \
37 {-h,--help}'[Show this help]' \
38 '--version[Show package version]' \
39 '*::coredumpctl commands:_coredumpctl_command'