update TODO
[thirdparty/systemd.git] / shell-completion / zsh / _systemd-coredumpctl
CommitLineData
70e104c4
WG
1#compdef systemd-coredumpctl
2
3_systemd-coredumpctl_command(){
4 local -a _systemd_coredumpctl_cmds
5 _systemd_coredumpctl_cmds=(
6 'list:List available coredumps'
a217fdc9
ZJS
7 'dump:Print coredump to stdout'
8 'gdb:Start gdb on a coredump'
70e104c4
WG
9 )
10 if (( CURRENT == 1 )); then
11 _describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
12 else
13 local curcontext="$curcontext"
14 local -a _dumps
15 cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
16 if (( $#cmd )); then
90e633a7
JSJ
17 # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
18 _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
70e104c4
WG
19 if [[ -n "$_dumps" ]]; then
20 _describe -t pids 'coredumps' _dumps
21 else
22 _message "no coredumps"
23 fi
24 else
25 _message "no more options"
26 fi
27 fi
28}
29
30_arguments \
862f4963
WG
31 {-o+,--output=}'[Write output to FILE]:output file:_files' \
32 {-F+,--field=}'[Show field in list output]:field' \
70e104c4
WG
33 '--no-pager[Do not pipe output into a pager]' \
34 {-h,--help}'[Show this help]' \
35 '--version[Show package version]' \
36 '*::systemd-coredumpctl commands:_systemd-coredumpctl_command'