about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorDanek Duvall <duvall@comfychair.org>2014-03-25 15:04:24 -0700
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-03-28 20:24:16 +0000
commit4dfe62640a786f60e72af64021910c6ac11167cc (patch)
tree89d6a8e38cadbc0642a7c2e419ab4aa0a912e196 /Completion
parentcd2eb07a788ceab8d0a5c3042a7711c5c6f5e60e (diff)
downloadzsh-4dfe62640a786f60e72af64021910c6ac11167cc.tar.gz
zsh-4dfe62640a786f60e72af64021910c6ac11167cc.tar.xz
zsh-4dfe62640a786f60e72af64021910c6ac11167cc.zip
32505: improved Solaris compatibility for pgrep completion
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_pgrep51
1 files changed, 47 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index f06d26e52..3b180ab2d 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -9,6 +9,7 @@ arguments=('-P[parent process id]:parent process id:->ppid'
      '-g[match only in process group ids]:group:->pgid'
      '-G[match only real group id]:group:_groups'
      '-j[match only in processes inside jails]:jail id:->jid'
+     '-J[match only in project ids]:project id:->projid'
      '-M[extract the name list from the specified core]:files:_files'
      '-N[extract the name list from the specified system]:files:_files'
      '-s[match only session id]:session id:->sid'
@@ -27,7 +28,8 @@ arguments=('-P[parent process id]:parent process id:->ppid'
      '-q[do not write anything to standard output]'
      '-S[search also in system processes]'
      '-v[negate matching]'
-     '-x[match exactly]')
+     '-x[match exactly]'
+     '-z[match only in zones]:zone:_zones')
 
 if [[ $service == 'pkill' ]]; then
   arguments+=('-'${^signals}'[signal]')
@@ -50,6 +52,13 @@ case "$OSTYPE" in
   darwin*)
     optchars="LafilnoqvxFGPUdgtu"
     ;;
+  solaris*)
+    optchars="flvxdnoPgsuUGJtTcz"
+    arguments=( ${arguments##-T*} )
+    arguments=( ${arguments##-c*} )
+    arguments+=( '-T[match only processes in task ids]:taskid:->task' )
+    arguments+=( '-c[match only processes in contract ids]:taskid:->contract' )
+    ;;
   *)
     optchars="flvxdnoPgsuUGt"
     ;;
@@ -82,7 +91,7 @@ case $state in
     if [[ $OSTYPE == freebsd* ]]; then
       sid=(${(uon)$(ps -ax -o sid=)})
     else
-      sid=(${(uon)$(ps -A o sid=)})
+      sid=(${(uon)$(ps -A -o sid=)})
     fi
 
     _wanted sid expl 'session id' compadd -S ',' -q -F used $sid
@@ -106,7 +115,7 @@ case $state in
     if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
       ppid=(${(uon)$(ps -ax -o ppid=)})
     else
-      ppid=(${(uon)$(ps -A o ppid=)})
+      ppid=(${(uon)$(ps -A -o ppid=)})
     fi
 
     _wanted ppid expl 'parent process id' compadd -S ',' -q -F used $ppid
@@ -120,12 +129,42 @@ case $state in
     if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
       pgid=(${(uon)$(ps -ax -o pgid=)})
     else
-      pgid=(${(uon)$(ps -A o pgid=)})
+      pgid=(${(uon)$(ps -A -o pgid=)})
     fi
 
     _wanted pgid expl 'process group id' compadd -S ',' -q -F used $pgid
     ;;
 
+  (projid)
+    compset -P '*,'
+
+    local -a used projid
+    used=(${(s:,:)IPREFIX})
+    projid=(${(uon)$(ps -A -o project=)})
+
+    _wanted projid expl 'project id' compadd -S ',' -q -F used $projid
+    ;;
+
+  (contract)
+    compset -P '*,'
+
+    local -a used ctid
+    used=(${(s:,:)IPREFIX})
+    ctid=(${(uon)$(ps -A -o ctid=)})
+
+    _wanted ctid expl 'contract id' compadd -S ',' -q -F used $ctid
+    ;;
+
+  (task)
+    compset -P '*,'
+
+    local -a used taskid
+    used=(${(s:,:)IPREFIX})
+    taskid=(${(uon)$(ps -A -o project=)})
+
+    _wanted taskid expl 'task id' compadd -S ',' -q -F used $taskid
+    ;;
+
   (pname)
     local ispat="pattern matching "
     if (( ${+opt_args[-x]} )); then
@@ -138,6 +177,8 @@ case $state in
         command="$(ps -axH -o command=)"
       elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
         command="$(ps -ax -o command=)"
+      elif [[ "$OSTYPE" == solaris* ]]; then
+        command="$(ps -A -o args=)"
       else
         command="$(ps -A o cmd=)"
       fi
@@ -147,6 +188,8 @@ case $state in
         command="$(ps -axcH -o command=)"
       elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
         command="$(ps -axc -o command=)"
+      elif [[ "$OSTYPE" == solaris* ]]; then
+        command="$(ps -A -o comm=)"
       else
         command="$(ps -A co cmd=)"
       fi