From e025336f2f6d9f107ee1e03b9900f04af0544ba9 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 1 Apr 2000 20:43:43 +0000 Subject: Updated from list as far as 10376 --- Completion/Builtins/_pids | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'Completion/Builtins/_pids') diff --git a/Completion/Builtins/_pids b/Completion/Builtins/_pids index 0ffda900b..7dec90e7d 100644 --- a/Completion/Builtins/_pids +++ b/Completion/Builtins/_pids @@ -3,16 +3,32 @@ # If given the `-m ' option, this tries to complete only pids # of processes whose command line match the `'. -local list expl match +local out list expl match desc listargs args + +_wanted processes || return 1 if [[ "$1" = -m ]]; then match="${2}*" shift 2 fi -_description expl 'process ID' +zstyle -s ":completion:${curcontext}:pids" command args + +out="$(_call pids ps 2>/dev/null)" -list=("${(@Mr:COLUMNS-1:)${(f@)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${~match}}") +if zstyle -T ":completion:${curcontext}:processes" verbose; then + zstyle -s ":completion:${curcontext}:pids-list" command listargs + (( $#listargs )) || listargs=( "$args[@]" ) + if [[ "$listargs" = "$args" ]]; then + list=("${(@Mr:COLUMNS-1:)${(f@)out}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${~match}}") + else + list=("${(@Mr:COLUMNS-1:)${(f@)$(_call pids-list ps 2>/dev/null)}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${~match}}") + fi + desc=(-ld list) +else + desc=() +fi -compadd "$expl[@]" "$@" -ld list - \ - ${${${(M)${(f)"$(ps $=compconfig[ps_args] 2>/dev/null)"}[2,-1]:#*${~match}}## #}%% *} +_all_labels processes expl 'process ID' \ + compadd "$@" "$desc[@]" - \ + ${${${(M)${(f)"${out}"}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]#*${~match}}## #}%% *} -- cgit 1.4.1