#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
