]>
Commit | Line | Data |
---|---|---|
682e043c | 1 | #compdef coredumpctl |
db9ecf05 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
70e104c4 | 3 | |
c501ecd7 | 4 | (( $+functions[_coredumpctl_commands] )) || |
5 | _coredumpctl_commands(){ | |
f4bab169 LP |
6 | local -a _coredumpctl_cmds |
7 | _coredumpctl_cmds=( | |
843cfcb1 ZJS |
8 | 'list:List available coredumps' |
9 | 'info:Show detailed information about one or more coredumps' | |
10 | 'dump:Print coredump to stdout' | |
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 \ | |
20927c0e EK |
33 | '(-o --output)'{-o+,--output=}'[Write output to FILE]:output file:_files' \ |
34 | '(-F --field)'{-F+,--field=}'[Show field in list output]:field' \ | |
720e0be0 | 35 | '-1[Show information about most recent entry only]' \ |
20927c0e EK |
36 | '(-S --since)'{-S,--since}'[Print entries since the specified date]' \ |
37 | '(-U --until)'{-U,--until}'[Print entries until the specified date]' \ | |
38 | '(-r --reverse)'{-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]' \ |
20927c0e EK |
41 | '(- *)'{-h,--help}'[Show this help]' \ |
42 | '(- *)--version[Show package version]' \ | |
ddc052dc | 43 | '--debugger=[Use the given debugger]:debugger: _command_names -e' \ |
20927c0e EK |
44 | '(-D --directory)'{-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \ |
45 | '(-q --quiet)'{-q,--quiet}'[Do not show info messages and privilege warning]' \ | |
d888ef68 | 46 | '--all[Look at all journal files instead of local ones]' \ |
c501ecd7 | 47 | '*::coredumpctl commands:_coredumpctl_commands' |