From 35b2633ad941966f5fca07b625a594a5b68c0fdb Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 15 Nov 1999 12:01:46 +0000 Subject: manual/8639 --- Completion/Core/_style | 74 +++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 40 deletions(-) (limited to 'Completion/Core/_style') 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 -- cgit 1.4.1