2019-04-05 11:41:35 +02:00
#compdef coredumpctl -*- shell-script -*-
2020-11-09 13:23:58 +09:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2013-07-29 14:09:10 -05:00
2018-12-24 05:15:38 -06:00
(( $+functions[_coredumpctl_commands] )) ||
_coredumpctl_commands(){
2014-06-19 13:46:01 +02:00
local -a _coredumpctl_cmds
_coredumpctl_cmds=(
2019-04-05 11:39:14 +02:00
'list:List available coredumps'
'info:Show detailed information about one or more coredumps'
'dump:Print coredump to stdout'
'debug:Start debugger (gdb) on a coredump'
2013-07-29 14:09:10 -05:00
)
if (( CURRENT == 1 )); then
2014-06-19 13:46:01 +02:00
_describe -t commands 'coredumpctl command' _coredumpctl_cmds
2013-07-29 14:09:10 -05: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 14:09:10 -05:00
if (( $#cmd )); then
2018-12-31 21:27:09 +01:00
_dumps=( "${(f)$(coredumpctl list -q --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
2013-07-29 14:09:10 -05:00
if [[ -n "$_dumps" ]]; then
2018-01-13 15:23:28 +01:00
_describe -V -t pids 'coredumps' _dumps
2013-07-29 14:09:10 -05:00
else
_message "no coredumps"
fi
else
_message "no more options"
fi
fi
}
_arguments \
2013-08-20 22:06:54 -05: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 21:30:59 +02:00
{-S,--since}'[Print entries since the specified date]' \
{-U,--until}'[Print entries until the specified date]' \
2017-02-14 23:08:46 +09:00
{-r,--reverse}'[Show the newest entries first]' \
2013-07-29 14:09:10 -05: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 14:09:10 -05:00
{-h,--help}'[Show this help]' \
'--version[Show package version]' \
2018-12-25 19:30:50 +01:00
'--debugger=[Use the given debugger]:debugger: _command_names -e' \
2018-12-25 22:57:23 +01:00
{-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \
2018-12-26 14:02:06 +01:00
{-q,--quiet}'[Do not show info messages and privilege warning]' \
2018-12-24 05:15:38 -06:00
'*::coredumpctl commands:_coredumpctl_commands'