mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 21:44:11 +01:00
moved from Completion/Core/_file_descriptors
This commit is contained in:
parent
888ff2fc2c
commit
bf5ca4e6e1
23
Completion/Zsh/Type/_file_descriptors
Normal file
23
Completion/Zsh/Type/_file_descriptors
Normal file
@ -0,0 +1,23 @@
|
||||
#autoload
|
||||
|
||||
local i fds expl list link
|
||||
|
||||
for i in {0..9}; [[ -e /dev/fd/$i ]] && fds=( ${fds[@]} $i )
|
||||
|
||||
if zstyle -T ":completion:${curcontext}" verbose && [[ -e /proc/$$/fd ]]; then
|
||||
if zmodload -e zsh/stat; then
|
||||
for i in "${fds[@]}"; do
|
||||
stat +link -A link /proc/$$/fd/$i
|
||||
list=( ${list[@]} "$i -- ${link[1]}" )
|
||||
done
|
||||
elif (( $+commands[readlink] )); then
|
||||
for i in "${fds[@]}"; list=( ${list[@]} "$i -- $(readlink /proc/$$/fd/$i)" )
|
||||
else
|
||||
for i in "${fds[@]}"; do
|
||||
list=( ${list[@]} "$i -- $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
|
||||
done
|
||||
fi
|
||||
_wanted file-descriptors expl 'file descriptors' compadd "$@" -d list -a fds
|
||||
else
|
||||
_wanted file-descriptors expl 'file descriptors' compadd "$@" -a fds
|
||||
fi
|
Loading…
Reference in New Issue
Block a user