2014-06-19 13:46:01 +02:00
|
|
|
#compdef coredumpctl
|
2017-11-18 18:21:19 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
2013-07-29 21:09:10 +02:00
|
|
|
|
2014-06-19 13:46:01 +02:00
|
|
|
_coredumpctl_command(){
|
|
|
|
local -a _coredumpctl_cmds
|
|
|
|
_coredumpctl_cmds=(
|
2013-07-29 21:09:10 +02:00
|
|
|
'list:List available coredumps'
|
2015-01-12 21:26:27 +01:00
|
|
|
'info:Show detailed information about one or more coredumps'
|
2013-08-02 13:58:56 +02:00
|
|
|
'dump:Print coredump to stdout'
|
2018-08-16 18:23:16 +02:00
|
|
|
'debug:Start debugger (gdb) on a coredump'
|
2013-07-29 21:09:10 +02:00
|
|
|
)
|
|
|
|
if (( CURRENT == 1 )); then
|
2014-06-19 13:46:01 +02:00
|
|
|
_describe -t commands 'coredumpctl command' _coredumpctl_cmds
|
2013-07-29 21:09:10 +02:00
|
|
|
else
|
|
|
|
local curcontext="$curcontext"
|
|
|
|
local -a _dumps
|
2014-06-19 13:46:01 +02:00
|
|
|
cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
|
2013-07-29 21:09:10 +02:00
|
|
|
if (( $#cmd )); then
|
2018-01-13 15:23:28 +01:00
|
|
|
_dumps=( "${(f)$(coredumpctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
|
2013-07-29 21:09:10 +02:00
|
|
|
if [[ -n "$_dumps" ]]; then
|
2018-01-13 15:23:28 +01:00
|
|
|
_describe -V -t pids 'coredumps' _dumps
|
2013-07-29 21:09:10 +02:00
|
|
|
else
|
|
|
|
_message "no coredumps"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
_message "no more options"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_arguments \
|
2013-08-21 05:06:54 +02:00
|
|
|
{-o+,--output=}'[Write output to FILE]:output file:_files' \
|
|
|
|
{-F+,--field=}'[Show field in list output]:field' \
|
2015-01-12 21:26:27 +01:00
|
|
|
'-1[Show information about most recent entry only]' \
|
2017-02-24 20:30:59 +01:00
|
|
|
{-S,--since}'[Print entries since the specified date]' \
|
|
|
|
{-U,--until}'[Print entries until the specified date]' \
|
2017-02-14 15:08:46 +01:00
|
|
|
{-r,--reverse}'[Show the newest entries first]' \
|
2013-07-29 21:09:10 +02:00
|
|
|
'--no-pager[Do not pipe output into a pager]' \
|
2015-01-12 21:26:27 +01:00
|
|
|
'--no-legend[Do not print the column headers]' \
|
2013-07-29 21:09:10 +02:00
|
|
|
{-h,--help}'[Show this help]' \
|
|
|
|
'--version[Show package version]' \
|
2018-08-16 18:23:16 +02:00
|
|
|
'--debugger=[Use the given debugger]' \
|
2014-06-19 13:46:01 +02:00
|
|
|
'*::coredumpctl commands:_coredumpctl_command'
|