about summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-04 15:44:57 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-04 15:44:57 +0000
commit4265f4b0264dd0efbce3c6b4b32f54a30af6c9bf (patch)
tree8f09814a83b389ce4b8bfddea6327abb6b5ab3f0 /Completion/Builtins
parentb7dc013ada073e23387cb34cc00834cd414c9441 (diff)
downloadzsh-4265f4b0264dd0efbce3c6b4b32f54a30af6c9bf.tar.gz
zsh-4265f4b0264dd0efbce3c6b4b32f54a30af6c9bf.tar.xz
zsh-4265f4b0264dd0efbce3c6b4b32f54a30af6c9bf.zip
Initial revision
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_pids18
1 files changed, 18 insertions, 0 deletions
diff --git a/Completion/Builtins/_pids b/Completion/Builtins/_pids
new file mode 100644
index 000000000..0ffda900b
--- /dev/null
+++ b/Completion/Builtins/_pids
@@ -0,0 +1,18 @@
+#autoload
+
+# If given the `-m <pattern>' option, this tries to complete only pids
+# of processes whose command line match the `<pattern>'.
+
+local list expl match
+
+if [[ "$1" = -m ]]; then
+  match="${2}*"
+  shift 2
+fi
+
+_description expl 'process ID'
+
+list=("${(@Mr:COLUMNS-1:)${(f@)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*${~match}}")
+
+compadd "$expl[@]" "$@" -ld list - \
+  ${${${(M)${(f)"$(ps $=compconfig[ps_args] 2>/dev/null)"}[2,-1]:#*${~match}}## #}%% *}