]>
Commit | Line | Data |
---|---|---|
f4bab169 | 1 | #compdef coredumpctl |
70e104c4 | 2 | |
f4bab169 LP |
3 | _coredumpctl_command(){ |
4 | local -a _coredumpctl_cmds | |
5 | _coredumpctl_cmds=( | |
70e104c4 | 6 | 'list:List available coredumps' |
720e0be0 | 7 | 'info:Show detailed information about one or more coredumps' |
a217fdc9 ZJS |
8 | 'dump:Print coredump to stdout' |
9 | 'gdb:Start gdb on a coredump' | |
70e104c4 WG |
10 | ) |
11 | if (( CURRENT == 1 )); then | |
f4bab169 | 12 | _describe -t commands 'coredumpctl command' _coredumpctl_cmds |
70e104c4 WG |
13 | else |
14 | local curcontext="$curcontext" | |
15 | local -a _dumps | |
f4bab169 | 16 | cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}" |
70e104c4 | 17 | if (( $#cmd )); then |
f4bab169 | 18 | # user can set zstyle ':completion:*:*:coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid |
673fca32 | 19 | _dumps=( "${(foa)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" ) |
70e104c4 WG |
20 | if [[ -n "$_dumps" ]]; then |
21 | _describe -t pids 'coredumps' _dumps | |
22 | else | |
23 | _message "no coredumps" | |
24 | fi | |
25 | else | |
26 | _message "no more options" | |
27 | fi | |
28 | fi | |
29 | } | |
30 | ||
31 | _arguments \ | |
862f4963 WG |
32 | {-o+,--output=}'[Write output to FILE]:output file:_files' \ |
33 | {-F+,--field=}'[Show field in list output]:field' \ | |
720e0be0 | 34 | '-1[Show information about most recent entry only]' \ |
70e104c4 | 35 | '--no-pager[Do not pipe output into a pager]' \ |
720e0be0 | 36 | '--no-legend[Do not print the column headers]' \ |
70e104c4 WG |
37 | {-h,--help}'[Show this help]' \ |
38 | '--version[Show package version]' \ | |
f4bab169 | 39 | '*::coredumpctl commands:_coredumpctl_command' |