blob: eb1ec35594e65feac36480d17e977368618d00de (
plain) (
blame)
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
|
#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
|