zsh-workers
 help / color / mirror / code / Atom feed
52fe4bf0ce5faba44df43f9fd549e7399af7436b blob 1528 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
#autoload

local i fds expl disp link sep
local -a list

fds=( /dev/fd/<3->(N:t) )
fds=( ${(n)fds} )

if zstyle -T ":completion:${curcontext}:file-descriptors" verbose; then
  zstyle -s ":completion:${curcontext}:file-descriptors" list-separator sep || sep=--
  if [[ $OSTYPE = solaris* ]]; then
    fds=( ${${(f)"$(pfiles $$|nawk 'NR==1{next} /^ *[0-9]*:/ {printf "\n%s", $1} / *\// {print $1}')"}:#[012]:*} )
    zformat -a list " $sep " $fds
    fds=( ${fds%%:*} )
  elif [[ ! -h /proc/$$/fd/$fds[1] ]]; then
    :
  elif zmodload -F zsh/stat b:zstat; then
    for i in "${fds[@]}"; do
      if zstat +link -A link /proc/$$/fd/$i; then
        list+=( "${(r.$#fds[-1].)i} $sep ${link[1]}" )
      else
        fds[(i)$i]=()
      fi
    done
  elif (( $+commands[readlink] )); then
    for i in "${fds[@]}"; do
      if link=$(readlink /proc/$$/fd/$i); then
        list+=( "${(r.$#fds[-1].)i} $sep $link" )
      else
        fds[(i)$i]=()
      fi
    done
  else
    for i in "${fds[@]}"; do
      if link=$(ls -l /proc/$$/fd/$i); then
        list+=( "${(r.$#fds[-1].)i} $sep ${link#* -> }" )
      else
        fds[(i)$i]=()
      fi
    done
  fi 2>/dev/null

  if (( list[(I)* $sep ?*] )); then
    list=(
      "${(r.$#fds[-1].):-0} $sep standard input"
      "${(r.$#fds[-1].):-1} $sep standard output"
      "${(r.$#fds[-1].):-2} $sep standard error" $list
    )
    disp=( -d list )
  fi
  fds=( 0 1 2 $fds )
fi

_description -V file-descriptors expl 'file descriptor'
compadd $disp "${@/-J/-V}" "$expl[@]" -a fds
debug log:

solving 52fe4bf ...
found 52fe4bf in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).