blob: d24e8f2a78714b65b53a848da07386632ebb36f6 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#autoload
# Complete 'globbing flags', i.e., '(#x)'; everything up to the '#' will
# have been "compset -P"'d by the caller.
local ret=1
local -a flags
local preprefix=$IPREFIX
compset -P '([ilIUubBmMcq]|a(|<->))##'
# make sure to not consider anything before the '#'
preprefix=${IPREFIX[$#preprefix,-1]}
if [[ $preprefix = *\#q* ]]; then
_globquals
return
elif [[ $preprefix = *q* ]]; then
_message 'q flag has to be specified by itself'
return
elif [[ $preprefix = *a(|<->) ]]; then
_message -e number 'errors'
if [[ $preprefix = *a ]]; then
return
else
compset -P '<->'
fi
elif [[ $preprefix = *\#c ]]; then
_message -e range 'repetitions (min,max) or (exact)'
return
fi
flags=(
'i:case insensitive'
'l:lower case characters match uppercase'
'I:case sensitive matching'
's:match start of string'
'e:match end of string'
'U:consider all characters to be one byte'
'u:support multibyte characters in pattern'
)
[[ $compstate[context] = condition ]] && flags+=(
'b:activate backreferences'
'B:deactivate backreferences'
'm:set reference to entire matched data'
'M:deactivate m flag'
)
flags=( ${flags:#[$preprefix[(R)\#,-1]]*} )
if [[ $IPREFIX != *'#' ]]; then
flags=( ${flags:#[se]*} )
fi
_describe -t globflags "glob flag" flags -Q -S ')' && ret=0
flags=(
'a:approximate matching'
'q:introduce glob qualifier'
'c:match repetitions of preceding pattern'
)
flags=( ${flags:#[$preprefix[(R)\#,-1]]*} )
if [[ $IPREFIX != *'#' ]]; then
flags=( ${flags:#[cq]*} )
fi
_describe -t globflags "glob flag" flags -Q -S '' && ret=0
return ret
|