zsh-workers
 help / color / mirror / code / Atom feed
0b2cd0015ce99b41dd604d23d5aa1aac58189de6 blob 1162 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
 
#autoload

local i fds expl link sep
local -a list

fds=( /dev/fd/<3->(N:t) )

if zstyle -T ":completion:${curcontext}:" verbose && [[ -h /proc/$$/fd/$fds[1] ]]; then
  zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
  if zmodload -F zsh/stat b:zstat; then
    for i in "${fds[@]}"; do
      if zstat +link -A link /proc/$$/fd/$i; then
        list+=( "$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+=( "$i $sep $link" )
      else
        fds[(i)$i]=()
      fi
    done
  else
    for i in "${fds[@]}"; do
      if link=$(ls -l /proc/$$/fd/$i); then
        list+=( "$i $sep ${link#* -> }" )
      else
        fds[(i)$i]=()
      fi
    done
  fi 2>/dev/null

  if (( $list[(I)* $sep ?*] )); then
    list=( "0 $sep standard input" "1 $sep standard output" "2 $sep standard error" $list )
    fds=( 0 1 2 $fds )
    _wanted file-descriptors expl 'file descriptor' compadd "$@" -d list -a - fds
    return
  fi
fi

_wanted file-descriptors expl 'file descriptor' compadd -a "$@" - fds
debug log:

solving 0b2cd00 ...
found 0b2cd00 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).