components/zsh/patches/completion.patch
branchs11-update
changeset 3503 bf3706873eae
parent 3046 1e256e706b72
child 7589 7eccd056eff6
equal deleted inserted replaced
3501:7838ef31ac9c 3503:bf3706873eae
   844 +		;;
   844 +		;;
   845 +
   845 +
   846  	("uninstall")
   846  	("uninstall")
   847  		_arguments -A "-*" \
   847  		_arguments -A "-*" \
   848  			'-F[Force]' \
   848  			'-F[Force]' \
   849 --- zsh-5.0.5/Completion/Unix/Command/_pgrep	Wed Nov 27 11:00:19 2013
       
   850 +++ zsh-5.0.5/Completion/Unix/Command/_pgrep	Sat Mar 29 09:41:30 2014
       
   851 @@ -1,32 +1,71 @@
       
   852 -#compdef pgrep pkill 
       
   853 +#compdef pgrep pkill
       
   854  
       
   855  local context state line ret=1 expl
       
   856  typeset -A opt_args
       
   857  typeset -a arguments
       
   858  
       
   859 -arguments=('-P[parent process id]:parent process id:->ppid' 
       
   860 -     '-g[match only in process group ids]:group:->pgid' 
       
   861 -     '-G[match only real group id]:group:_groups' 
       
   862 -     '-s[match only session id]:session id:->sid' 
       
   863 +arguments=('-P[parent process id]:parent process id:->ppid'
       
   864 +     '-F[match only in process in pidfile]:files:_files'
       
   865 +     '-g[match only in process group ids]:group:->pgid'
       
   866 +     '-G[match only real group id]:group:_groups'
       
   867 +     '-j[match only in processes inside jails]:jail id:->jid'
       
   868 +     '-J[match only in project ids]:project id:->projid'
       
   869 +     '-M[extract the name list from the specified core]:files:_files'
       
   870 +     '-N[extract the name list from the specified system]:files:_files'
       
   871 +     '-s[match only session id]:session id:->sid'
       
   872       '-t[match only controlled by terminal]:terminal device:->tty'
       
   873 -     '-u[match only effective user id]:user:_users' 
       
   874 -     '-U[match only real user id]:user:_users' 
       
   875 -           '(-n)-o[oldest process]' 
       
   876 -     '(-o)-n[newest process]' 
       
   877 -     '-f[match against full command line]' 
       
   878 -     '-v[negate matching]' 
       
   879 -     '-x[match exactly]' 
       
   880 -     '*:process name:->pname')
       
   881 +     '-T[match only in processes specified routing table in rtable]'
       
   882 +     '-u[match only effective user id]:user:_users'
       
   883 +     '-U[match only real user id]:user:_users'
       
   884 +     '(-n)-o[oldest process]'
       
   885 +     '(-o)-n[newest process]'
       
   886 +     '-a[include process ancestors in the match list]'
       
   887 +     '-c[print a count of matching processes]'
       
   888 +     '-f[match against full command line]'
       
   889 +     '-i[ignore case distinctions]'
       
   890 +     '-I[confirmation before attempting to single each process]'
       
   891 +     '-L[given pidfile must be locked]'
       
   892 +     '-q[do not write anything to standard output]'
       
   893 +     '-S[search also in system processes]'
       
   894 +     '-v[negate matching]'
       
   895 +     '-x[match exactly]'
       
   896 +     '-z[match only in zones]:zone:_zones')
       
   897  
       
   898 -if [[ $service == 'pkill' ]]
       
   899 -then
       
   900 +if [[ $service == 'pkill' ]]; then
       
   901    arguments+=('-'${^signals}'[signal]')
       
   902 -elif [[ $service == 'pgrep' ]]
       
   903 -then
       
   904 +elif [[ $service == 'pgrep' ]]; then
       
   905    arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}'
       
   906          '-l[list name in addition to id]')
       
   907  fi
       
   908  
       
   909 +local optchars
       
   910 +case "$OSTYPE" in
       
   911 +  linux*)
       
   912 +    optchars="cflvxdnoPgsuUGt"
       
   913 +    ;;
       
   914 +  freebsd*)
       
   915 +    optchars="LSafilnoqvxFGMNPUdgjstu"
       
   916 +    ;;
       
   917 +  openbsd*)
       
   918 +    optchars="flnoqvxdGgPsTtUu"
       
   919 +    ;;
       
   920 +  darwin*)
       
   921 +    optchars="LafilnoqvxFGPUdgtu"
       
   922 +    ;;
       
   923 +  solaris*)
       
   924 +    optchars="flvxdnoPgsuUGJtTcz"
       
   925 +    arguments=( ${arguments##-T*} )
       
   926 +    arguments=( ${arguments##-c*} )
       
   927 +    arguments+=( '-T[match only processes in task ids]:taskid:->task' )
       
   928 +    arguments+=( '-c[match only processes in contract ids]:taskid:->contract' )
       
   929 +    ;;
       
   930 +  *)
       
   931 +    optchars="flvxdnoPgsuUGt"
       
   932 +    ;;
       
   933 +esac
       
   934 +arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*}
       
   935 +     '*:process name:->pname')
       
   936 +
       
   937  _arguments -s -w $arguments && ret=0
       
   938  
       
   939  case $state in
       
   940 @@ -39,23 +78,45 @@
       
   941      ttys=( /dev/tty*(N) /dev/pts/*(N) )
       
   942      _wanted tty expl 'terminal device' compadd -S ',' -q -F used ${ttys#/dev/}
       
   943      ;;
       
   944 -    
       
   945 +
       
   946    (sid)
       
   947 +    if [[ $OSTYPE == openbsd* ]]; then
       
   948 +      break
       
   949 +    fi
       
   950 +
       
   951      compset -P '*,'
       
   952  
       
   953      local -a used sid
       
   954      used=(${(s:,:)IPREFIX})
       
   955 -    sid=(${(uon)$(ps -A o sid=)})
       
   956 +    if [[ $OSTYPE == freebsd* ]]; then
       
   957 +      sid=(${(uon)$(ps -ax -o sid=)})
       
   958 +    else
       
   959 +      sid=(${(uon)$(ps -A -o sid=)})
       
   960 +    fi
       
   961  
       
   962      _wanted sid expl 'session id' compadd -S ',' -q -F used $sid
       
   963      ;;
       
   964 -  
       
   965 +
       
   966 +  (jid)
       
   967 +    compset -P '*,'
       
   968 +
       
   969 +    local -a used jid
       
   970 +    used=(${(s:,:)IPREFIX})
       
   971 +    jid=(${(uon)$(ps -ax -o jid=)})
       
   972 +
       
   973 +    _wanted jid expl 'jail id' compadd -S ',' -q -F used $jid
       
   974 +    ;;
       
   975 +
       
   976    (ppid)
       
   977      compset -P '*,'
       
   978  
       
   979      local -a used ppid
       
   980      used=(${(s:,:)IPREFIX})
       
   981 -    ppid=(${(uon)$(ps -A o ppid=)})
       
   982 +    if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
       
   983 +      ppid=(${(uon)$(ps -ax -o ppid=)})
       
   984 +    else
       
   985 +      ppid=(${(uon)$(ps -A -o ppid=)})
       
   986 +    fi
       
   987  
       
   988      _wanted ppid expl 'parent process id' compadd -S ',' -q -F used $ppid
       
   989      ;;
       
   990 @@ -65,25 +126,77 @@
       
   991  
       
   992      local -a used pgid
       
   993      used=(${(s:,:)IPREFIX})
       
   994 -    pgid=(${(uon)$(ps -A o pgid=)})
       
   995 +    if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
       
   996 +      pgid=(${(uon)$(ps -ax -o pgid=)})
       
   997 +    else
       
   998 +      pgid=(${(uon)$(ps -A -o pgid=)})
       
   999 +    fi
       
  1000  
       
  1001      _wanted pgid expl 'process group id' compadd -S ',' -q -F used $pgid
       
  1002      ;;
       
  1003 -  
       
  1004 +
       
  1005 +  (projid)
       
  1006 +    compset -P '*,'
       
  1007 +
       
  1008 +    local -a used projid
       
  1009 +    used=(${(s:,:)IPREFIX})
       
  1010 +    projid=(${(uon)$(ps -A -o project=)})
       
  1011 +
       
  1012 +    _wanted projid expl 'project id' compadd -S ',' -q -F used $projid
       
  1013 +    ;;
       
  1014 +
       
  1015 +  (contract)
       
  1016 +    compset -P '*,'
       
  1017 +
       
  1018 +    local -a used ctid
       
  1019 +    used=(${(s:,:)IPREFIX})
       
  1020 +    ctid=(${(uon)$(ps -A -o ctid=)})
       
  1021 +
       
  1022 +    _wanted ctid expl 'contract id' compadd -S ',' -q -F used $ctid
       
  1023 +    ;;
       
  1024 +
       
  1025 +  (task)
       
  1026 +    compset -P '*,'
       
  1027 +
       
  1028 +    local -a used taskid
       
  1029 +    used=(${(s:,:)IPREFIX})
       
  1030 +    taskid=(${(uon)$(ps -A -o project=)})
       
  1031 +
       
  1032 +    _wanted taskid expl 'task id' compadd -S ',' -q -F used $taskid
       
  1033 +    ;;
       
  1034 +
       
  1035    (pname)
       
  1036      local ispat="pattern matching "
       
  1037 -    if (( ${+opt_args[-x]} ))
       
  1038 -    then
       
  1039 +    if (( ${+opt_args[-x]} )); then
       
  1040        ispat=""
       
  1041      fi
       
  1042 -    if (( ${+opt_args[-f]} ))
       
  1043 -    then
       
  1044 -      _wanted pname expl $ispat'process command line' compadd ${(u)${(f)"$(ps -A o cmd=)"}}
       
  1045 +
       
  1046 +    local command
       
  1047 +    if (( ${+opt_args[-f]} )); then
       
  1048 +      if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then
       
  1049 +        command="$(ps -axH -o command=)"
       
  1050 +      elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
       
  1051 +        command="$(ps -ax -o command=)"
       
  1052 +      elif [[ "$OSTYPE" == solaris* ]]; then
       
  1053 +        command="$(ps -A -o args=)"
       
  1054 +      else
       
  1055 +        command="$(ps -A o cmd=)"
       
  1056 +      fi
       
  1057 +      _wanted pname expl $ispat'process command line' compadd ${(u)${(f)${command}}}
       
  1058      else
       
  1059 -      _wanted pname expl $ispat'process name' compadd ${(u)${(f)"$(ps -A co cmd=)"}}
       
  1060 +      if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then
       
  1061 +        command="$(ps -axcH -o command=)"
       
  1062 +      elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
       
  1063 +        command="$(ps -axc -o command=)"
       
  1064 +      elif [[ "$OSTYPE" == solaris* ]]; then
       
  1065 +        command="$(ps -A -o comm=)"
       
  1066 +      else
       
  1067 +        command="$(ps -A co cmd=)"
       
  1068 +      fi
       
  1069 +      _wanted pname expl $ispat'process name' compadd ${(u)${(f)${command}}}
       
  1070      fi
       
  1071      ;;
       
  1072 -  
       
  1073 +
       
  1074  esac && ret=0
       
  1075  
       
  1076  return ret
       
  1077 --- zsh-5.0.5/Completion/Unix/Command/_zfs	Thu Jan  2 14:23:56 2014
   849 --- zsh-5.0.5/Completion/Unix/Command/_zfs	Thu Jan  2 14:23:56 2014
  1078 +++ zsh-5.0.5/Completion/Unix/Command/_zfs	Sat Mar 29 11:35:15 2014
   850 +++ zsh-5.0.5/Completion/Unix/Command/_zfs	Sat Mar 29 11:35:15 2014
  1079 @@ -1,5 +1,5 @@
   851 @@ -1,5 +1,5 @@
  1080  #compdef zfs
   852  #compdef zfs
  1081 -# Synced with the S11U1 man page
   853 -# Synced with the S11U1 man page