summaryrefslogtreecommitdiffstats
path: root/shell-completion/systemd-zsh-completion.zsh
diff options
context:
space:
mode:
authorDaniel Wallace <danielwallace@gtmanfred.com>2013-05-06 01:09:53 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-06 22:49:15 +0200
commit9494131b91decc5300f9bbfa0568e64546d7917a (patch)
treea1a15691eed52e27285702bbeffaedfd6cd26c6a /shell-completion/systemd-zsh-completion.zsh
parentman: fix typos in systemd.special (diff)
downloadsystemd-9494131b91decc5300f9bbfa0568e64546d7917a.tar.xz
systemd-9494131b91decc5300f9bbfa0568e64546d7917a.zip
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.
Diffstat (limited to '')
-rw-r--r--shell-completion/systemd-zsh-completion.zsh9
1 files changed, 5 insertions, 4 deletions
diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
index b29a2e9223..411646ea59 100644
--- a/shell-completion/systemd-zsh-completion.zsh
+++ b/shell-completion/systemd-zsh-completion.zsh
@@ -896,12 +896,13 @@ _systemd-coredumpctl_command(){
_describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
else
local curcontext="$curcontext"
- local -a dumps
+ local -a _dumps
cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
if (( $#cmd )); then
- dumps=( "${(f)$(_call_program dumps "systemd-coredumpctl list 2>/dev/null")}" )
- if [[ -n "$dumps" ]]; then
- compadd "${dumps[@]}"
+ # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
+ _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
+ if [[ -n "$_dumps" ]]; then
+ _describe -t pids 'coredumps' _dumps
else
_message "no coredumps"
fi