mirror of
https://github.com/systemd/systemd.git
synced 2025-02-27 01:57:35 +03:00
zsh_completion: complete only pids for systemd-coredumpctl
Instead of completing the whole line, which doesn't work, only complete the pid, but still show the whole line so the user can see which command was which. Users can also let the parameter expansion sort the completion by date instead of by pid, by setting zstyle ':completion:*:*:systemd-coredumpctl:*' sort no so that the zshcompsys doesn't sort the _describe function for only systemd-coredumpctl.
This commit is contained in:
parent
ab75ca91dc
commit
9494131b91
@ -896,12 +896,13 @@ _systemd-coredumpctl_command(){
|
|||||||
_describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
|
_describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
|
||||||
else
|
else
|
||||||
local curcontext="$curcontext"
|
local curcontext="$curcontext"
|
||||||
local -a dumps
|
local -a _dumps
|
||||||
cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
|
cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
|
||||||
if (( $#cmd )); then
|
if (( $#cmd )); then
|
||||||
dumps=( "${(f)$(_call_program dumps "systemd-coredumpctl list 2>/dev/null")}" )
|
# user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
|
||||||
if [[ -n "$dumps" ]]; then
|
_dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
|
||||||
compadd "${dumps[@]}"
|
if [[ -n "$_dumps" ]]; then
|
||||||
|
_describe -t pids 'coredumps' _dumps
|
||||||
else
|
else
|
||||||
_message "no coredumps"
|
_message "no coredumps"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user