blob: a3b54686f21222d00e1869aa293432b6a71a1b1d (
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
|
#autoload
local all get val i
# Should we return the value?
if [[ "$1" = -g ]]; then
get=yes
shift
fi
# Get all styles defined for this context.
all=()
for i in "${(s.:.)_cur_contexts}"; do
all=("$all[@]" "${(@)_compstyles[(K)${i},${1}]}" )
done
all=":${(j.:.)${(@o)all:#}##??}:"
if [[ "$all" = *:${2}[:\=]* ]]; then
# We have a definition for the style.
if [[ $# -eq 3 ]]; then
if [[ -n "$get" ]]; then
# We have to return the value.
if [[ "$all" = *,${2}\=* ]]; then
eval "${3}=\"${${all#*:${2}\=}%%:*}\""
else
eval "${3}=''"
fi
else
# We have to test the value.
if [[ "$all" = *:${2}\=* ]]; then
[[ "${${all#*:${2}\=}%%:*}" = ${~3} ]]
else
[[ '' -eq ${~3} ]]
fi
return
fi
fi
return 0
fi
return 1
|