about summary refs log tree commit diff
path: root/Completion/Core/_style
blob: 6e2de23df8cd7a87c3d766ef45edec106b44a772 (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
#autoload

local val ret

# Should we return the value?

case "$1" in
-b)
  compstyles -S "$context" "$2" val
  ret="$?"

  if [[ "$val" = (#I)(yes|true|1|on) ]]; then
    eval "${3}=yes"
  else
    eval "${3}=no"
  fi

  return ret;
  ;;
-s)
  compstyles -S "${curcontext}${2:+:${2}}" "$3" "$4"
  return
  ;;
-a)
  compstyles -A "${curcontext}${2:+:${2}}" "$3" "$4"
  return
  ;;
-h)
  compstyles -H "${curcontext}${2:+:${2}}" "$3" "$4"
  return
  ;;
esac

[[ "$1" = -(|-) ]] && shift

if compstyles -S "${curcontext}${1:+:${1}}" "$2" val; then
  if [[ $# -eq 3 ]]; then
    [[ "$val" = ${~3} ]]
  else
    [[ "$val" = (#I)(yes|true|1|on) ]]
  fi
else
  return 1
fi