]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_coredumpctl
Merge pull request #7540 from fbuihuu/systemd-delta-tweaks
[thirdparty/systemd.git] / shell-completion / zsh / _coredumpctl
1 #compdef coredumpctl
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 _coredumpctl_command(){
5 local -a _coredumpctl_cmds
6 _coredumpctl_cmds=(
7 'list:List available coredumps'
8 'info:Show detailed information about one or more coredumps'
9 'dump:Print coredump to stdout'
10 'gdb:Start gdb on a coredump'
11 )
12 if (( CURRENT == 1 )); then
13 _describe -t commands 'coredumpctl command' _coredumpctl_cmds
14 else
15 local curcontext="$curcontext"
16 local -a _dumps
17 cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
18 if (( $#cmd )); then
19 _dumps=( "${(f)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
20 if [[ -n "$_dumps" ]]; then
21 _describe -V -t pids 'coredumps' _dumps
22 else
23 _message "no coredumps"
24 fi
25 else
26 _message "no more options"
27 fi
28 fi
29 }
30
31 _arguments \
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 {-S,--since}'[Print entries since the specified date]' \
36 {-U,--until}'[Print entries until the specified date]' \
37 {-r,--reverse}'[Show the newest entries first]' \
38 '--no-pager[Do not pipe output into a pager]' \
39 '--no-legend[Do not print the column headers]' \
40 {-h,--help}'[Show this help]' \
41 '--version[Show package version]' \
42 '*::coredumpctl commands:_coredumpctl_command'