]>
Commit | Line | Data |
---|---|---|
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 | # user can set zstyle ':completion:*:*:coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid | |
20 | _dumps=( "${(foa)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" ) | |
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 \ | |
33 | {-o+,--output=}'[Write output to FILE]:output file:_files' \ | |
34 | {-F+,--field=}'[Show field in list output]:field' \ | |
35 | '-1[Show information about most recent entry only]' \ | |
36 | {-S,--since}'[Print entries since the specified date]' \ | |
37 | {-U,--until}'[Print entries until the specified date]' \ | |
38 | {-r,--reverse}'[Show the newest entries first]' \ | |
39 | '--no-pager[Do not pipe output into a pager]' \ | |
40 | '--no-legend[Do not print the column headers]' \ | |
41 | {-h,--help}'[Show this help]' \ | |
42 | '--version[Show package version]' \ | |
43 | '*::coredumpctl commands:_coredumpctl_command' |