]>
Commit | Line | Data |
---|---|---|
f4bab169 | 1 | #compdef coredumpctl |
7059062c | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
70e104c4 | 3 | |
c501ecd7 | 4 | (( $+functions[_coredumpctl_commands] )) || |
5 | _coredumpctl_commands(){ | |
f4bab169 LP |
6 | local -a _coredumpctl_cmds |
7 | _coredumpctl_cmds=( | |
70e104c4 | 8 | 'list:List available coredumps' |
720e0be0 | 9 | 'info:Show detailed information about one or more coredumps' |
a217fdc9 | 10 | 'dump:Print coredump to stdout' |
53956faf | 11 | 'debug:Start debugger (gdb) on a coredump' |
70e104c4 WG |
12 | ) |
13 | if (( CURRENT == 1 )); then | |
f4bab169 | 14 | _describe -t commands 'coredumpctl command' _coredumpctl_cmds |
70e104c4 WG |
15 | else |
16 | local curcontext="$curcontext" | |
17 | local -a _dumps | |
f4bab169 | 18 | cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}" |
70e104c4 | 19 | if (( $#cmd )); then |
0e9ab1af | 20 | _dumps=( "${(f)$(coredumpctl list -q --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" ) |
70e104c4 | 21 | if [[ -n "$_dumps" ]]; then |
a6e4952d | 22 | _describe -V -t pids 'coredumps' _dumps |
70e104c4 WG |
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]' \ | |
ddc052dc | 43 | '--debugger=[Use the given debugger]:debugger: _command_names -e' \ |
10dd7e74 | 44 | {-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \ |
ffc7a6e9 | 45 | {-q,--quiet}'[Do not show info messages and privilege warning]' \ |
c501ecd7 | 46 | '*::coredumpctl commands:_coredumpctl_commands' |