mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-30 19:20:53 +02:00
36 lines
824 B
Text
36 lines
824 B
Text
#autoload
|
|
|
|
local opts opt type=file
|
|
|
|
opts=()
|
|
while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:" opt; do
|
|
case "$opt" in
|
|
/) [[ "$type" = file ]] && type=dir ;;
|
|
g) [[ "$type" = (file|dir) ]] && type="$OPTARG" ;;
|
|
q) opts=("$opts[@]" -q ) ;;
|
|
[^f]) opts=("$opts[@]" "-$opt" "$OPTARG") ;;
|
|
esac
|
|
done
|
|
|
|
case "$type" in
|
|
file) _tags file ;;
|
|
dir) _tags path file ;;
|
|
*) _tags glob path file ;;
|
|
esac
|
|
|
|
while _tags; do
|
|
if _requested file; then
|
|
_path_files "$opts[@]" -f
|
|
return
|
|
elif _requested path; then
|
|
if _requested glob; then
|
|
_path_files "$opts[@]" -/g "$type" && return 0
|
|
else
|
|
_path_files "$opts[@]" -/g "$type" && return 0
|
|
fi
|
|
elif _requested glob; then
|
|
_path_files "$opts[@]" -g "$type" && return 0
|
|
fi
|
|
done
|
|
|
|
return 1
|