1 #compdef systemd-coredumpctl
3 _systemd-coredumpctl_command(){
4 local -a _systemd_coredumpctl_cmds
5 _systemd_coredumpctl_cmds=(
6 'list:List available coredumps'
7 'dump:Print coredump to std'
9 if (( CURRENT == 1 )); then
10 _describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
12 local curcontext="$curcontext"
14 cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
16 # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
17 _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
18 if [[ -n "$_dumps" ]]; then
19 _describe -t pids 'coredumps' _dumps
21 _message "no coredumps"
24 _message "no more options"
30 {-o,--output=}'[Write output to FILE]:output file:_files' \
31 '--no-pager[Do not pipe output into a pager]' \
32 {-h,--help}'[Show this help]' \
33 '--version[Show package version]' \
34 '*::systemd-coredumpctl commands:_systemd-coredumpctl_command'