blob: e667289c55696ae3b45081d60c72a0a2aaaf77cc (
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
|
#autoload
local opts opt type=file prios tags
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 -f "$funcstack[2]" file ;;
dir) _tags -f "$funcstack[2]" path file ;;
*) _tags -f "$funcstack[2]" glob path file ;;
esac
while _tags; do
[[ "$tags" = *:file:* ]] && { _path_files "$opts[@]" -f ; return }
[[ "$tags" = *:path:* ]] && _path_files "$opts[@]" -/ && return 0
[[ "$tags" = *:glob:* ]] && _path_files "$opts[@]" -g "$type" && return 0
done
return 1
|