2021-06-16 22:35:12 +03:00
#compdef coredumpctl
2020-11-09 07:23:58 +03:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2013-07-29 23:09:10 +04:00
2018-12-24 14:15:38 +03:00
(( $+functions[_coredumpctl_commands] )) ||
_coredumpctl_commands(){
2014-06-19 15:46:01 +04:00
local -a _coredumpctl_cmds
_coredumpctl_cmds=(
2019-04-05 12:39:14 +03: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 23:09:10 +04:00
)
if (( CURRENT == 1 )); then
2014-06-19 15:46:01 +04:00
_describe -t commands 'coredumpctl command' _coredumpctl_cmds
2013-07-29 23:09:10 +04:00
else
local curcontext="$curcontext"
local -a _dumps
2014-06-19 15:46:01 +04:00
cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
2013-07-29 23:09:10 +04:00
if (( $#cmd )); then
2018-12-31 23:27:09 +03:00
_dumps=( "${(f)$(coredumpctl list -q --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
2013-07-29 23:09:10 +04:00
if [[ -n "$_dumps" ]]; then
2018-01-13 17:23:28 +03:00
_describe -V -t pids 'coredumps' _dumps
2013-07-29 23:09:10 +04:00
else
_message "no coredumps"
fi
else
_message "no more options"
fi
fi
}
_arguments \
2013-08-21 07:06:54 +04:00
{-o+,--output=}'[Write output to FILE]:output file:_files' \
{-F+,--field=}'[Show field in list output]:field' \
2015-01-12 23:26:27 +03:00
'-1[Show information about most recent entry only]' \
2017-02-24 22:30:59 +03:00
{-S,--since}'[Print entries since the specified date]' \
{-U,--until}'[Print entries until the specified date]' \
2017-02-14 17:08:46 +03:00
{-r,--reverse}'[Show the newest entries first]' \
2013-07-29 23:09:10 +04:00
'--no-pager[Do not pipe output into a pager]' \
2015-01-12 23:26:27 +03:00
'--no-legend[Do not print the column headers]' \
2013-07-29 23:09:10 +04:00
{-h,--help}'[Show this help]' \
'--version[Show package version]' \
2018-12-25 21:30:50 +03:00
'--debugger=[Use the given debugger]:debugger: _command_names -e' \
2018-12-26 00:57:23 +03:00
{-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \
2018-12-26 16:02:06 +03:00
{-q,--quiet}'[Do not show info messages and privilege warning]' \
2021-10-06 15:47:46 +03:00
'--all[Look at all journal files instead of local ones]' \
2018-12-24 14:15:38 +03:00
'*::coredumpctl commands:_coredumpctl_commands'