]>
Commit | Line | Data |
---|---|---|
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 ZJS |
9 | 'dump:Print coredump to stdout' |
10 | 'gdb:Start 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 |
f4bab169 | 19 | # user can set zstyle ':completion:*:*:coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid |
673fca32 | 20 | _dumps=( "${(foa)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" ) |
70e104c4 WG |
21 | if [[ -n "$_dumps" ]]; then |
22 | _describe -t pids 'coredumps' _dumps | |
23 | else | |
24 | _message "no coredumps" | |
25 | fi | |
26 | else | |
27 | _message "no more options" | |
28 | fi | |
29 | fi | |
30 | } | |
31 | ||
32 | _arguments \ | |
862f4963 WG |
33 | {-o+,--output=}'[Write output to FILE]:output file:_files' \ |
34 | {-F+,--field=}'[Show field in list output]:field' \ | |
720e0be0 | 35 | '-1[Show information about most recent entry only]' \ |
15710d44 GS |
36 | {-S,--since}'[Print entries since the specified date]' \ |
37 | {-U,--until}'[Print entries until the specified date]' \ | |
5badf05f | 38 | {-r,--reverse}'[Show the newest entries first]' \ |
70e104c4 | 39 | '--no-pager[Do not pipe output into a pager]' \ |
720e0be0 | 40 | '--no-legend[Do not print the column headers]' \ |
70e104c4 WG |
41 | {-h,--help}'[Show this help]' \ |
42 | '--version[Show package version]' \ | |
f4bab169 | 43 | '*::coredumpctl commands:_coredumpctl_command' |