]>
Commit | Line | Data |
---|---|---|
e842803a | 1 | #compdef coredumpctl |
52ad194e | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
14228c0d | 3 | |
e842803a MB |
4 | _coredumpctl_command(){ |
5 | local -a _coredumpctl_cmds | |
6 | _coredumpctl_cmds=( | |
14228c0d | 7 | 'list:List available coredumps' |
e735f4d4 | 8 | 'info:Show detailed information about one or more coredumps' |
14228c0d | 9 | 'dump:Print coredump to stdout' |
6e866b33 | 10 | 'debug:Start debugger (gdb) on a coredump' |
14228c0d MB |
11 | ) |
12 | if (( CURRENT == 1 )); then | |
e842803a | 13 | _describe -t commands 'coredumpctl command' _coredumpctl_cmds |
14228c0d MB |
14 | else |
15 | local curcontext="$curcontext" | |
16 | local -a _dumps | |
e842803a | 17 | cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}" |
14228c0d | 18 | if (( $#cmd )); then |
1d42b86d | 19 | _dumps=( "${(f)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" ) |
14228c0d | 20 | if [[ -n "$_dumps" ]]; then |
1d42b86d | 21 | _describe -V -t pids 'coredumps' _dumps |
14228c0d MB |
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' \ | |
e735f4d4 | 34 | '-1[Show information about most recent entry only]' \ |
2897b343 MP |
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]' \ | |
14228c0d | 38 | '--no-pager[Do not pipe output into a pager]' \ |
e735f4d4 | 39 | '--no-legend[Do not print the column headers]' \ |
14228c0d MB |
40 | {-h,--help}'[Show this help]' \ |
41 | '--version[Show package version]' \ | |
6e866b33 | 42 | '--debugger=[Use the given debugger]' \ |
e842803a | 43 | '*::coredumpctl commands:_coredumpctl_command' |