about summary refs log tree commit diff
path: root/Completion/Core/_style
blob: d666a9fd861ea81482bc134d22b84125b6600969 (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 "${curcontext}${2:+:${2}}" "$3" _val
  _ret="$?"

  if [[ "$_val" = (yes|true|1|on) ]]; then
    eval "${4}=yes"
  else
    eval "${4}=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" = (yes|true|1|on) ]]
  fi
else
  return 1
fi