about summary refs log tree commit diff
path: root/Completion/Core/_style
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
commit35b2633ad941966f5fca07b625a594a5b68c0fdb (patch)
treeb54740d014e594ba5d81931cdcdb3387bcf9dfca /Completion/Core/_style
parentbb98460a01ce1f6c1e71f7e401f782c81b71486b (diff)
downloadzsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.gz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.xz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.zip
manual/8639
Diffstat (limited to 'Completion/Core/_style')
-rw-r--r--Completion/Core/_style74
1 files changed, 34 insertions, 40 deletions
diff --git a/Completion/Core/_style b/Completion/Core/_style
index a3b54686f..6e2de23df 100644
--- a/Completion/Core/_style
+++ b/Completion/Core/_style
@@ -1,50 +1,44 @@
 #autoload
 
-local all get val i
+local val ret
 
 # 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:#}##??}:"
+case "$1" in
+-b)
+  compstyles -S "$context" "$2" val
+  ret="$?"
 
-if [[ "$all" = *:${2}[:\=]* ]]; then
-
-  # We have a definition for the style.
+  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
-    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
+    [[ "$val" = ${~3} ]]
+  else
+    [[ "$val" = (#I)(yes|true|1|on) ]]
   fi
-  return 0
+else
+  return 1
 fi
-
-return 1