]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_coredumpctl
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / shell-completion / zsh / _coredumpctl
1 #compdef coredumpctl
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 (( $+functions[_coredumpctl_commands] )) ||
5 _coredumpctl_commands(){
6 local -a _coredumpctl_cmds
7 _coredumpctl_cmds=(
8 'list:List available coredumps'
9 'info:Show detailed information about one or more coredumps'
10 'dump:Print coredump to stdout'
11 'debug:Start debugger (gdb) on a coredump'
12 )
13 if (( CURRENT == 1 )); then
14 _describe -t commands 'coredumpctl command' _coredumpctl_cmds
15 else
16 local curcontext="$curcontext"
17 local -a _dumps
18 cmd="${${_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
19 if (( $#cmd )); then
20 _dumps=( "${(f)$(coredumpctl list -q --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $4,$0}' 2>/dev/null)}" )
21 if [[ -n "$_dumps" ]]; then
22 _describe -V -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 '--debugger=[Use the given debugger]:debugger: _command_names -e' \
44 {-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \
45 {-q,--quiet}'[Do not show info messages and privilege warning]' \
46 '*::coredumpctl commands:_coredumpctl_commands'