#autoload # If given the `-m ' option, this tries to complete only pids # of processes whose command line match the `'. local list expl match desc listargs args _wanted processes expl 'process ID' || return 1 if [[ "$1" = -m ]]; then match="${2}*" shift 2 fi _style -a ps list-arguments listargs _style -a ps arguments args (( $#listargs )) || listargs=( "$args[@]" ) if _style processes verbose; then list=("${(@Mr:COLUMNS-1:)${(f@)$(ps $listargs 2>/dev/null)}[2,-1]:#[ ]#${PREFIX}[0-9]#${SUFFIX}[ ]*${~match}}") desc=(-ld list) else desc=() fi compadd "$expl[@]" "$@" "$desc[@]" - \ ${${${(M)${(f)"$(ps $args 2>/dev/null)"}[2,-1]:#*${~match}}## #}%% *}