zsh-workers
 help / color / mirror / code / Atom feed
66a4eb34b14df77abdee77f1a2d8a6a4325b8ca6 blob 1510 bytes (raw)

 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
 
# This makes defining styles a bit simpler by using a single `+' as a
# special token that allows one to append a context name to the
# previously used context name. Like this:
#
#   zstyle+ ':foo:bar' style1 value1 \
#         + ':baz'     style2 value2 \
#         + ':frob'    style3 value3
#
# This defines style1 with value1 for the context :foo:bar as usual.
# But it also defines styles2 with value2 for the context :foo:bar:baz
# and style3 with value3 for :foo:bar:frob.
# Of course, any of the sub-contexts after the plus signs may be 
# empty strings to re-use the previous context unchanged.
#
# If you don't want to change all your calls to `zstyle' to use
# `zstyle+' you can use an alias `alias zstyle=zstyle+' and make sure
# the completion functions are autoloaded without alias expansion (the
# -U option to the autoload builtin). The completion system normally
# loads its functions with without alias expansion.
#
# Tue Oct 15 20:38:16 CEST 2019
# The option -p prints the value of the style. The normal usage is to
# use it in place of the option -s and to omit the output parameter.

case "$1" in
-p) shift; local value; zstyle -s "$@" value; print -r -- "$value";;

-*) zstyle "$@";;

*)  setopt localoptions noksharrays
    integer i
    local context="$1"
    1=''
    for ((i=2; $#; ++i)); do
      if [[ $i -gt $# || "$argv[i]" == '+' ]]; then
        zstyle "$context${(@)argv[1,i-1]}"
        shift "i > $# ? $# : i"  # Stupid shift error on i > $#
  	i=1
      fi
    done;;
esac
debug log:

solving 66a4eb34b ...
found 66a4eb34b in https://inbox.vuxu.org/zsh-workers/CAKc7PVCzAuby5-JP5iyKY6D8yBfRTU=AyhYdwt0vr-rwO4QVNw@mail.gmail.com/
found 81b4f0552 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 81b4f05526b75f225dbe42e81a1dec247000983d	Functions/Misc/zstyle+

applying [1/1] https://inbox.vuxu.org/zsh-workers/CAKc7PVCzAuby5-JP5iyKY6D8yBfRTU=AyhYdwt0vr-rwO4QVNw@mail.gmail.com/
diff --git a/Functions/Misc/zstyle+ b/Functions/Misc/zstyle+
index 81b4f0552..66a4eb34b 100644

Checking patch Functions/Misc/zstyle+...
Applied patch Functions/Misc/zstyle+ cleanly.

index at:
100644 66a4eb34b14df77abdee77f1a2d8a6a4325b8ca6	Functions/Misc/zstyle+

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).