mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-07 11:41:16 +02:00
11165: Completion/Base/_regex_arguments, Completion/Debian/_apt,
Completion/X/_xset, Completion/X/_xwit, Doc/Zsh/compsys.yo, Src/Modules/zutil.c: _regex_arguments support tag stuff.
This commit is contained in:
parent
672f5c459e
commit
3e7a2a41bc
7 changed files with 1208 additions and 699 deletions
|
@ -1,5 +1,9 @@
|
|||
2000-05-04 Tanaka Akira <akr@zsh.org>
|
||||
|
||||
* 11165: Completion/Base/_regex_arguments, Completion/Debian/_apt,
|
||||
Completion/X/_xset, Completion/X/_xwit, Doc/Zsh/compsys.yo,
|
||||
Src/Modules/zutil.c: _regex_arguments support tag stuff.
|
||||
|
||||
* 11157: Completion/Core/_requested: fail if _all_labels is failed.
|
||||
|
||||
2000-05-04 Peter Stephenson <pws@cambridgesiliconradio.com>
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
## usage: _regex_arguments funcname regex
|
||||
|
||||
## configuration key used:
|
||||
|
||||
# regex_arguments_path
|
||||
# The path to a directory for caching. (default: ~/.zsh/regex_arguments)
|
||||
|
||||
##
|
||||
|
||||
# _regex_arguments compiles `regex' and emit the result of the state
|
||||
# machine into the function `funcname'. `funcname' parses a command line
|
||||
# according to `regex' and evaluate appropriate actions in `regex'. Before
|
||||
|
@ -12,385 +19,89 @@
|
|||
|
||||
## regex word definition:
|
||||
|
||||
# elt-pattern = "/" ( pattern | "[]" ) # cutoff
|
||||
# | "%" pattern # non-cutoff
|
||||
# lookahead = "@" pattern
|
||||
# parse-action = "-" zsh-code-to-eval
|
||||
# complete-action = "!" zsh-code-to-eval
|
||||
# pattern = "/" ( glob | "[]" ) "/" [ "+" | "-" ]
|
||||
# lookahead = "%" glob "%"
|
||||
# guard = "-" zsh-code-to-eval
|
||||
# caction = ":" zsh-code-to-eval
|
||||
# action = "{" zsh-code-to-eval "}"
|
||||
|
||||
## regex word sequence definition:
|
||||
|
||||
# element = elt-pattern [ lookahead ] [ parse-action ] [ complete-action ]
|
||||
#
|
||||
# element = pattern [ lookahead ] [ guard ] [ caction ]
|
||||
#
|
||||
# regex = element
|
||||
# | "(" regex ")"
|
||||
# | regex "#"
|
||||
# | regex regex
|
||||
# | ( regex | action ) #
|
||||
# | regex "|" regex
|
||||
# | void
|
||||
# | null
|
||||
#
|
||||
# NOTE: void and null has no explicit representation. However null can
|
||||
# be represent with empty words such as \( \).
|
||||
|
||||
# example: (in zsh quoted form)
|
||||
|
||||
# $'[^\0]#\0' \# : zero or more words
|
||||
|
||||
## auxiliary functions definition:
|
||||
|
||||
# fst : a * b -> a
|
||||
# snd : a * b -> b
|
||||
# fst( (x, y) ) = x
|
||||
# snd( (x, y) ) = y
|
||||
|
||||
# nullable : regex -> bool
|
||||
# first : regex -> list of element
|
||||
# match : string * list of element -> element + {bottom}
|
||||
# right : string * element -> string
|
||||
# left : string * element -> string
|
||||
# next : regex * element -> regex + {bottom}
|
||||
# trans : string * string * regex -> (string * string * regex) + {bottom}
|
||||
|
||||
# nullable(void) = false
|
||||
# nullable(null) = true
|
||||
# nullable(e) = false
|
||||
# nullable(r #) = true
|
||||
# nullable(r1 r2) = nullable(r1) and nullable(r2)
|
||||
# nullable(r1 | r2) = nullable(r1) or nullable(r2)
|
||||
|
||||
# first(void) = {}
|
||||
# first(null) = {}
|
||||
# first(e) = [ e ]
|
||||
# first(r #) = first(r)
|
||||
# first(r1 r2) = nullable(r1) ? first(r1) ++ first(r2) : first(r1)
|
||||
# first(r1 | r2) = first(r1) ++ first(r2)
|
||||
|
||||
# match(s, []) = bottom
|
||||
# match(s, [e1, e2, ...]) = e if [[ $s = $elt-pattern[e]$lookahead[e]* ]]
|
||||
# | match(s, [e2, ...]) otherwise
|
||||
|
||||
# right(s, e) = ${s##$elt-pattern[e]}
|
||||
# left(s, e) = ${(M)s##$elt-pattern[e]}
|
||||
|
||||
### XXX: It can treat lookaheads if zsh provide $1, $2, ... in perl.
|
||||
|
||||
# next(void, e) = bottom
|
||||
# next(null, e) = bottom
|
||||
# next(e1, e0) = e1 eq e0 ? null : bottom # eq is test operator of identity equality.
|
||||
# next(r #, e) = next(r, e) != bottom ? next(r, e) (r #) : bottom
|
||||
# next(r1 r2, e) = next(r1, e) != bottom ? next(r1, e) r2 : next(r2, e)
|
||||
# next(r1 | r2, e) = next(r1, e) != bottom ? next(r1, e) : next(r2, e)
|
||||
|
||||
# trans( (t, s, r) ) = ( (cutoff(e) ? '' : t ++ left(s, e)), right(s, e), next(r, e) )
|
||||
# where e = match(s, first(r))
|
||||
|
||||
# NOTE: This `next' definition is slightly different to ordinaly one.
|
||||
# This definition uses only one element of first(r) for transition
|
||||
# instead of all elements of first(r).
|
||||
|
||||
# If _regex_arguments takes the regex r0, the first state of the state
|
||||
# machine is r0. The state of the state machine transit as follows.
|
||||
|
||||
# ('', s0, r0) -> trans('', s0, r0) = (t1, s1, r1) -> trans(t1, s1, r1) -> ...
|
||||
|
||||
# If the state is reached to bottom, the state transition is stopped.
|
||||
|
||||
# ... -> (tN, sN, rN) -> bottom
|
||||
|
||||
# For each transitions (tI, sI, rI) to trans(tI, sI, rI), the state
|
||||
# machine evaluate parse-action bound to match(sI, first(rI)).
|
||||
|
||||
# In parse-action bound to match(sI, first(rI)) = e, it can refer variables:
|
||||
# _ra_left : tI+1
|
||||
# _ra_match : left(sI, e)
|
||||
# _ra_right : sI+1
|
||||
|
||||
# If the state transition is stopped, the state machine evaluate
|
||||
# complete-actions bound to first(rN) if tN and sN does not contain NUL.
|
||||
# When complete-actions are evaluated, completion focus is restricted to
|
||||
# tN ++ sN. (This is reason of tN and sN cannot contain NUL when
|
||||
# completion.)
|
||||
# Also, if there are last transitions that does not cut off the string
|
||||
# (tJ ++ sJ = tJ+1 ++ sJ+1 = ... = tN-1 ++ sN-1 = tN ++ sN),
|
||||
# complete-actions bound to them
|
||||
# --- match(sJ, first(rJ)), ..., match(sN-1, first(rN-1)) --- are also
|
||||
# evaluated before complete-actions bound to first(rN).
|
||||
|
||||
# example:
|
||||
|
||||
# compdef _tst tst
|
||||
|
||||
# _regex_arguments _tst /$'[^\0]#\0' /$'[^\0]#\0' '!compadd aaa'
|
||||
# _regex_arguments _tst /$'[^\0]#\0'/ /$'[^\0]#\0'/ :'compadd aaa'
|
||||
# _tst complete `aaa' for first argument.
|
||||
# First $'[^\0]#\0' is required to match with command name.
|
||||
|
||||
# _regex_arguments _tst /$'[^\0]#\0' \( /$'[^\0]#\0' '!compadd aaa' /$'[^\0]#\0' !'compadd bbb' \) \#
|
||||
# _regex_arguments _tst /$'[^\0]#\0'/ \( /$'[^\0]#\0'/ :'compadd aaa' /$'[^\0]#\0'/ :'compadd bbb' \) \#
|
||||
# _tst complete `aaa' for (2i+1)th argument and `bbb' for (2i)th argument.
|
||||
|
||||
# _regex_arguments _tst /$'[^\0]#\0' \( /$'[^\0]#\0' '!compadd aaa' \| /$'[^\0]#\0' !'compadd bbb' \) \#
|
||||
# _regex_arguments _tst /$'[^\0]#\0'/ \( /$'[^\0]#\0'/ :'compadd aaa' \| /$'[^\0]#\0'/ :'compadd bbb' \) \#
|
||||
# _tst complete `aaa' or `bbb'.
|
||||
|
||||
## Recursive decent regex parser
|
||||
|
||||
_ra_parse_elt () {
|
||||
: index=$index "[$regex[$index]]"
|
||||
local state
|
||||
if (( $#regex < index )); then
|
||||
return 1
|
||||
else
|
||||
case "$regex[index]" in
|
||||
[/%]*) state=$index
|
||||
first=($state)
|
||||
last=($state)
|
||||
nullable=
|
||||
case "${regex[index][1]}" in
|
||||
/) cutoff[$state]=yes ;;
|
||||
%) cutoff[$state]= ;;
|
||||
esac
|
||||
pattern[$state]="${regex[index++][2,-1]}"
|
||||
[[ -n "$pattern[$state]" ]] && pattern[$state]="($pattern[$state])"
|
||||
if [[ $index -le $#regex && $regex[index] = @* ]]; then
|
||||
lookahead[$state]="${regex[index++][2,-1]}"
|
||||
[[ -n "$lookahead[$state]" ]] && lookahead[$state]="($lookahead[$state])"
|
||||
else
|
||||
lookahead[$state]=""
|
||||
fi
|
||||
if [[ $index -le $#regex && $regex[index] = -* ]]; then
|
||||
parse_action[$state]="${regex[index++][2,-1]}"
|
||||
else
|
||||
parse_action[$state]=""
|
||||
fi
|
||||
if [[ $index -le $#regex && $regex[index] = \!* ]]; then
|
||||
complete_action[$state]="${regex[index++][2,-1]}"
|
||||
else
|
||||
complete_action[$state]=""
|
||||
fi
|
||||
;;
|
||||
\() (( index++ ))
|
||||
_ra_parse_alt || return 1
|
||||
[[ $index -le $#regex && "$regex[$index]" = \) ]] || return 1
|
||||
(( index++ ))
|
||||
;;
|
||||
*) return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# return status of parser functions:
|
||||
|
||||
return 0
|
||||
}
|
||||
# 0 : success
|
||||
# 1 : parse error
|
||||
# 2 : fatal parse error
|
||||
|
||||
_ra_parse_clo () {
|
||||
: index=$index "[$regex[$index]]"
|
||||
_ra_parse_elt || return 1
|
||||
|
||||
if (( index <= $#regex )) && [[ "$regex[$index]" = \# ]]; then
|
||||
(( index++ ))
|
||||
nullable=yes
|
||||
|
||||
for i in $last; do tbl[$i]="$tbl[$i] $first"; done
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_ra_parse_seq () {
|
||||
: index=$index "[$regex[$index]]"
|
||||
local last_seq
|
||||
local first_seq nullable_seq
|
||||
first_seq=()
|
||||
nullable_seq=yes
|
||||
|
||||
_ra_parse_clo || {
|
||||
first=()
|
||||
last=()
|
||||
nullable=yes
|
||||
return 0
|
||||
}
|
||||
first_seq=($first)
|
||||
last_seq=($last)
|
||||
[[ -n "$nullable" ]] || nullable_seq=
|
||||
|
||||
while :; do
|
||||
_ra_parse_clo || break
|
||||
for i in $last_seq; do tbl[$i]="${tbl[$i]} $first"; done
|
||||
[[ -n "$nullable_seq" ]] && first_seq=($first_seq $first)
|
||||
[[ -n "$nullable" ]] || { nullable_seq= last_seq=() }
|
||||
last_seq=($last_seq $last)
|
||||
done
|
||||
|
||||
first=($first_seq)
|
||||
nullable=$nullable_seq
|
||||
last=($last_seq)
|
||||
return 0
|
||||
}
|
||||
|
||||
_ra_parse_alt () {
|
||||
: index=$index "[$regex[$index]]"
|
||||
local last_alt
|
||||
local first_alt nullable_alt
|
||||
first_alt=()
|
||||
nullable_alt=
|
||||
|
||||
_ra_parse_seq || return 1
|
||||
first_alt=($first_alt $first)
|
||||
last_alt=($last_alt $last)
|
||||
[[ -n "$nullable" ]] && nullable_alt=yes
|
||||
|
||||
while :; do
|
||||
(( index <= $#regex )) || break
|
||||
[[ "$regex[$index]" = \| ]] || break
|
||||
(( index++ ))
|
||||
|
||||
_ra_parse_seq || break
|
||||
first_alt=($first_alt $first)
|
||||
last_alt=($last_alt $last)
|
||||
[[ -n "$nullable" ]] && nullable_alt=yes
|
||||
done
|
||||
|
||||
first=($first_alt)
|
||||
last=($last_alt)
|
||||
nullable=$nullable_alt
|
||||
return 0
|
||||
}
|
||||
|
||||
## function generator
|
||||
|
||||
_ra_gen_func () {
|
||||
local old new
|
||||
local state next index
|
||||
local start="${(j/:/)first}"
|
||||
|
||||
old=()
|
||||
new=($start)
|
||||
|
||||
print -lr - \
|
||||
"$funcname () {" \
|
||||
'setopt localoptions extendedglob' \
|
||||
'local _ra_state _ra_left _ra_match _ra_right _ra_actions _ra_tmp' \
|
||||
"_ra_state='$start'" \
|
||||
'_ra_left=' \
|
||||
'_ra_right="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX"' \
|
||||
'_ra_actions=()' \
|
||||
'while :; do' \
|
||||
'case "$_ra_state" in'
|
||||
|
||||
while (( $#new )); do
|
||||
state="$new[1]"
|
||||
shift new
|
||||
old=("$old[@]" "$state")
|
||||
|
||||
print -lr - \
|
||||
"$state)" \
|
||||
'case "$_ra_right" in'
|
||||
|
||||
for index in ${(s/:/)state}; do
|
||||
if [[ "$pattern[$index]" != "([])" ]]; then
|
||||
next="${(j/:/)${(@)=tbl[$index]}}"
|
||||
print -lr - \
|
||||
"$pattern[$index]$lookahead[$index]*)"
|
||||
if [[ -n "$pattern[$index]" ]]; then
|
||||
if [[ -n "$cutoff[$index]" ]]; then
|
||||
print -lr - \
|
||||
'_ra_match="${(M)_ra_right##'"$pattern[$index]"'}"' \
|
||||
'_ra_right="$_ra_right[$#_ra_match + 1, -1]"' \
|
||||
'_ra_left=' \
|
||||
'if (( $#_ra_match )); then' \
|
||||
'_ra_actions=()'
|
||||
if [[ -n "${complete_action[$index]:q}" ]]; then
|
||||
print -lr - \
|
||||
'else' \
|
||||
'_ra_actions=("$_ra_actions[@]" '"${complete_action[$index]:q}"')'
|
||||
fi
|
||||
print -lr - \
|
||||
'fi'
|
||||
else
|
||||
print -lr - \
|
||||
'_ra_match="${(M)_ra_right##'"$pattern[$index]"'}"' \
|
||||
'_ra_right="$_ra_right[$#_ra_match + 1, -1]"' \
|
||||
'_ra_left="$_ra_left$_ra_match"'
|
||||
if [[ -n "${complete_action[$index]:q}" ]]; then
|
||||
print -lr - \
|
||||
'_ra_actions=("$_ra_actions[@]" '"${complete_action[$index]:q}"')'
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print -lr - \
|
||||
'_ra_match=' \
|
||||
'_ra_actions=("$_ra_actions[@]" '"${complete_action[$index]:q}"')'
|
||||
fi
|
||||
print -lr - \
|
||||
"$parse_action[$index]"
|
||||
if [[ -n $next ]]; then
|
||||
print -lr - \
|
||||
"_ra_state=$next"
|
||||
(( $old[(I)$next] || $new[(I)$next] )) || new=($next "$new[@]")
|
||||
else
|
||||
print -lr - \
|
||||
'_message "no arg"' \
|
||||
'break'
|
||||
fi
|
||||
print -lr - \
|
||||
';;'
|
||||
fi
|
||||
done
|
||||
|
||||
print -lr - \
|
||||
'*)' \
|
||||
'if [[ "$_ra_left$_ra_right" = *$'\''\0'\''* ]]; then' \
|
||||
'_message "parse failed before current word"' \
|
||||
'else' \
|
||||
'compset -p $(( $#PREFIX - $#_ra_right - $#_ra_left ))'
|
||||
|
||||
print -lr - \
|
||||
'for _ra_tmp in $_ra_actions; do' \
|
||||
'eval "$_ra_tmp"' \
|
||||
'done'
|
||||
for index in ${(s/:/)state}; do
|
||||
print -lr - \
|
||||
"$complete_action[$index]"
|
||||
done
|
||||
|
||||
print -lr - \
|
||||
'fi' \
|
||||
'break' \
|
||||
';;' \
|
||||
'esac' \
|
||||
';;'
|
||||
done
|
||||
|
||||
print -lr - \
|
||||
'esac' \
|
||||
'done' \
|
||||
'}'
|
||||
_ra_comp () {
|
||||
_ra_actions=("$_ra_actions[@]" "$1")
|
||||
}
|
||||
|
||||
_regex_arguments () {
|
||||
setopt localoptions extendedglob
|
||||
|
||||
local funcname="_regex_arguments_tmp"
|
||||
local funcdef
|
||||
|
||||
typeset -A tbl cutoff pattern lookahead parse_action complete_action
|
||||
local regex index first last nullable
|
||||
local i state next
|
||||
|
||||
funcname="$1"
|
||||
local regex funcname="$1"
|
||||
shift
|
||||
regex=(${@:/(#b):(*)/":_ra_comp ${(qqqq)match[1]}"})
|
||||
|
||||
regex=("$@")
|
||||
index=1
|
||||
tbl=()
|
||||
pattern=()
|
||||
lookahead=()
|
||||
parse_action=()
|
||||
complete_action=()
|
||||
_ra_parse_alt
|
||||
|
||||
funcdef="$(_ra_gen_func)"
|
||||
|
||||
unfunction "$funcname" 2>/dev/null
|
||||
eval "${(F)funcdef}"
|
||||
eval \
|
||||
"$funcname"' () {
|
||||
local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com expl tmp nm="$compstate[nmatches]"
|
||||
local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX"
|
||||
_ra_actions=()
|
||||
zregexparse -c _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
|
||||
case "$?" in
|
||||
0|2) _message "no more arguments";;
|
||||
1)
|
||||
if [[ "$_ra_line[_ra_p1 + 1, -1]" = *$'\''\0'\''* ]]; then
|
||||
_message "parse failed before current word"
|
||||
else
|
||||
_ra_left="$_ra_line[_ra_p1 + 1, _ra_p2]"
|
||||
_ra_right="$_ra_line[_ra_p2 + 1, -1]"
|
||||
compset -p $(( $#PREFIX - $#_ra_line + $_ra_p1 ))
|
||||
: "$_ra_actions[@]"
|
||||
tmp=("${(@)_ra_actions%%:*}")
|
||||
if (( $#tmp )); then
|
||||
_tags "$tmp[@]"
|
||||
while _tags; do
|
||||
for _ra_com in "$_ra_actions[@]"; do
|
||||
if _requested "${_ra_com%%:*}"; then
|
||||
while _next_label "${_ra_com%%:*}" expl "${${_ra_com#*:}%%:*}"; do
|
||||
eval "${_ra_com#*:*:}"
|
||||
done
|
||||
[[ nm -ne "$compstate[nmatches]" ]] && break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
3) _message "invalid regex";;
|
||||
esac
|
||||
[[ nm -ne "$compstate[nmatches]" ]]
|
||||
}'
|
||||
}
|
||||
|
||||
_regex_arguments "$@"
|
||||
|
|
|
@ -75,9 +75,9 @@ _apt_arguments () {
|
|||
nul=$'\0'
|
||||
qnul="\$'\\0'"
|
||||
|
||||
comp_bool='_wanted values expl_bool "boolean value" compadd "$expl_bool[@]" '"$bool"
|
||||
comp_bool='compadd "$expl[@]" '"$bool"
|
||||
comp_intlevel= #"_message 'intlevel'"
|
||||
comp_configfile='_files "$expl_configfile[@]"'
|
||||
comp_configfile='_files "$expl[@]"'
|
||||
comp_arbitem= #"_message 'Foo::Bar=bar'"
|
||||
|
||||
comp_short=\
|
||||
|
@ -116,15 +116,15 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_short=("$regex_short[@]"
|
||||
/"$short_seq(${(j:|:)short_hasarg})(=|)"/
|
||||
-'_apt_consume_short ${match[1]%=}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
|
||||
\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)short_hasarg})$nul"/
|
||||
-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%'$qnul'}[-1]}]}'
|
||||
/"$word"/ :"$comp_hasarg" \|
|
||||
/"$word"/ ":options:option:$comp_hasarg" \|
|
||||
/"(${(j:|:)short_hasarg})="/
|
||||
-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
|
||||
\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -134,15 +134,15 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
-'_apt_consume_short ${match[1]%%('$qnul'('${(j:|:)bool}')|('${(j:|:)bool}')|)'$qnul'}' \|
|
||||
/"$short_seq(${(j:|:)short_bool})="/
|
||||
-'_apt_consume_short ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
|
||||
\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)short_bool})="/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
|
||||
\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
|
||||
/"(${(j:|:)short_bool})$nul"/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
|
||||
/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -152,15 +152,15 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
-'_apt_consume_short ${match[1]%%'"($qnul$intlevel|$intlevel|)$qnul"'}' \|
|
||||
/"$short_seq(${(j:|:)short_intlevel})="/
|
||||
-'_apt_consume_short ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)short_intlevel})="/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
|
||||
/"(${(j:|:)short_intlevel})$nul"/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
/"($intlevel$nul|)"/ :"$comp_intlevel" \|
|
||||
/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -168,15 +168,15 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_short=("$regex_short[@]"
|
||||
/"$short_seq(${(j:|:)short_configfile})(=|)"/
|
||||
-'_apt_consume_short ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
|
||||
\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)short_configfile})$nul"/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
/"$word"/ :"$comp_configfile" \|
|
||||
/"$word"/ ":files:config file:$comp_configfile" \|
|
||||
/"(${(j:|:)short_configfile})="/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
|
||||
\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -184,15 +184,15 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_short=("$regex_short[@]"
|
||||
/"$short_seq(${(j:|:)short_arbitem})(=|)"/
|
||||
-'_apt_consume_short ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)short_arbitem})$nul"/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
/"$word"/ :"$comp_arbitem" \|
|
||||
/"$word"/ ":options:option:$comp_arbitem" \|
|
||||
/"(${(j:|:)short_arbitem})="/
|
||||
-'_apt_consume_short ${match[1][-2]}'
|
||||
\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -200,18 +200,18 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_long=("$regex_long[@]"
|
||||
/"(${(j:|:)long_hasarg})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
|
||||
/"$word"/ :"$comp_hasarg" \|
|
||||
/"$word"/ ":options:option:$comp_hasarg" \|
|
||||
/"(${(j:|:)long_hasarg})="/
|
||||
-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
|
||||
\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)long_hasarg})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
|
||||
/"$word"/ :"$comp_hasarg" \|
|
||||
/"$word"/ ":options:option:$comp_hasarg" \|
|
||||
/"(${(j:|:)long_hasarg})="/
|
||||
-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
|
||||
\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -219,18 +219,18 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_long=("$regex_long[@]"
|
||||
/"(${(j:|:)long_bool})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
|
||||
\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
|
||||
/"(${(j:|:)long_bool})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
|
||||
/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)long_bool})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
|
||||
\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
|
||||
/"(${(j:|:)long_bool})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
|
||||
/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -238,18 +238,18 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_long=("$regex_long[@]"
|
||||
/"(${(j:|:)long_intlevel})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
|
||||
/"(${(j:|:)long_intlevel})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"($intlevel$nul|)"/ :"$comp_intlevel" \|
|
||||
/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)long_intlevel})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
|
||||
/"(${(j:|:)long_intlevel})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"($intlevel$nul|)"/ :"$comp_intlevel" \|
|
||||
/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -257,18 +257,18 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_long=("$regex_long[@]"
|
||||
/"(${(j:|:)long_configfile})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"$word"/ :"$comp_configfile" \|
|
||||
/"$word"/ ":files:config file:$comp_configfile" \|
|
||||
/"(${(j:|:)long_configfile})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
|
||||
\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)long_configfile})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"$word"/ :"$comp_configfile" \|
|
||||
/"$word"/ ":files:config file:$comp_configfile" \|
|
||||
/"(${(j:|:)long_configfile})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
|
||||
\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -276,18 +276,18 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
regex_long=("$regex_long[@]"
|
||||
/"(${(j:|:)long_arbitem})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"$word"/ :"$comp_arbitem" \|
|
||||
/"$word"/ ":options:option:$comp_arbitem" \|
|
||||
/"(${(j:|:)long_arbitem})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
|
||||
)
|
||||
regex_long_prefix=("$regex_long_prefix[@]"
|
||||
/"(${(j:|:)long_arbitem})$nul"/
|
||||
-'_apt_consume_long ${match[1]%'$qnul'}'
|
||||
/"$word"/ :"$comp_arbitem" \|
|
||||
/"$word"/ ":options:option:$comp_arbitem" \|
|
||||
/"(${(j:|:)long_arbitem})="/
|
||||
-'_apt_consume_long ${match[1]%=}'
|
||||
\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
|
||||
\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -296,9 +296,9 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
\( /--/+ \( "$regex_long[@]"
|
||||
/"(${(j:|:)bool})-"/+
|
||||
\( "$regex_long_prefix[@]"
|
||||
/"[]"/ :"$comp_long_prefix" \) \) \|
|
||||
/"[]"/ ":options:option:$comp_long_prefix" \) \) \|
|
||||
/-/+ \( "$regex_short[@]" /"[]"/ \) \|
|
||||
/"[]"/ :"$comp_opt" \) \#
|
||||
/"[]"/ ":options:option:$comp_opt" \) \#
|
||||
"$regex_all[@]"
|
||||
)
|
||||
|
||||
|
@ -324,11 +324,6 @@ _describe -o option tmp2 -- tmp3 -S='
|
|||
long_arbitem=($long_arbitem)
|
||||
bool_prefix=($bool_prefix)
|
||||
|
||||
local expl_opt expl_bool expl_configfile
|
||||
_description options expl_opt option
|
||||
_description values expl_bool 'boolean value'
|
||||
_description files expl_configfile 'config file'
|
||||
|
||||
local current_option tmp1 tmp2 tmp3
|
||||
|
||||
${funcname}_sm
|
||||
|
@ -375,16 +370,16 @@ _apt-get () {
|
|||
-- \
|
||||
/$'update\0'/ \| \
|
||||
/$'upgrade\0'/ \| \
|
||||
/$'install\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" uninstalled || _deb_packages "$expl_packages[@]" installed' \# \| \
|
||||
/$'remove\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" installed' \# \| \
|
||||
/$'install\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" uninstalled || _deb_packages "$expl_packages[@]" installed' \# \| \
|
||||
/$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
|
||||
/$'dist-upgrade\0'/ \| \
|
||||
/$'dselect-upgrade\0'/ \| \
|
||||
/$'clean\0'/ \| \
|
||||
/$'autoclean\0'/ \| \
|
||||
/$'check\0'/ \| \
|
||||
/$'source\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'source\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'help\0/' \| \
|
||||
/"[]"/ :'_wanted actions expl_action action compadd update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
|
||||
/"[]"/ ':argument-1::compadd "$expl_action[@]" update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
|
||||
|
||||
_apt-get () {
|
||||
local expl_action expl_packages
|
||||
|
@ -411,18 +406,18 @@ _apt-cache () {
|
|||
-o,--option:arbitem \
|
||||
-- \
|
||||
/$'help\0'/ \| \
|
||||
/$'add\0'/ /$'[^\0]#\0'/ :'_files' \# \| \
|
||||
/$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files "$expl[@]"' \# \| \
|
||||
/$'gencaches\0'/ \| \
|
||||
/$'showpkg\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'stats\0'=$status[4]/ \| \
|
||||
/$'dump\0'/ \| \
|
||||
/$'dumpavail\0'/ \| \
|
||||
/$'unmet\0'/ \| \
|
||||
/$'check\0'/ \| \
|
||||
/$'search\0'/ /$'[^\0]#\0'/ :'_message "pattern"' \| \
|
||||
/$'show\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'search\0'/ /$'[^\0]#\0'/ ':strings::_message "pattern"' \| \
|
||||
/$'show\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
|
||||
/$'depends\0'/ \| \
|
||||
/"[]"/ :'_wanted actions expl_action action compadd help add gencaches showpkg stats dump dumpavail unmet check search show depends'
|
||||
/"[]"/ ':argument-1::compadd "$expl_action[@]" help add gencaches showpkg stats dump dumpavail unmet check search show depends'
|
||||
|
||||
_apt-cache () {
|
||||
local expl_action expl_packages expl_pkg_cache expl_src_cache
|
||||
|
@ -451,7 +446,7 @@ _apt-cdrom () {
|
|||
-o,--option:arbitem \
|
||||
-- \
|
||||
/$'add\0'/ \| \
|
||||
/"[]"/ :'_wanted actions expl_action action compadd add'
|
||||
/"[]"/ ':argument-1::compadd "$expl_action[@]" add'
|
||||
|
||||
_apt-cdrom () {
|
||||
local expl_action expl_mount_point
|
||||
|
@ -465,7 +460,7 @@ _apt-cdrom () {
|
|||
}
|
||||
|
||||
_apt-config () {
|
||||
_apt_arguments _apt-config_sm \
|
||||
_apt_arguments _apt-config \
|
||||
-h,--help:bool \
|
||||
-v,--version:bool \
|
||||
-c,--config-file:configfile \
|
||||
|
@ -473,20 +468,11 @@ _apt-config () {
|
|||
-- \
|
||||
/$'shell\0'/ \
|
||||
\( \
|
||||
/$'[^\0]#\0'/ :'_wanted parameters expl_shell_var "shell variable to assign" compadd - "${(@k)parameters}"' \
|
||||
/$'[^\0]#\0'/ :'_wanted configuration-keys expl_config_key "configuration key" compadd - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
|
||||
/$'[^\0]#\0'/ ':parameters:shell variable to assign:compadd "$expl[@]" - "${(@k)parameters}"' \
|
||||
/$'[^\0]#\0'/ ':values:configuration key:compadd "$expl[@]" - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
|
||||
\) \# \| \
|
||||
/$'dump\0'/ \| \
|
||||
/"[]"/ :'_wanted actions expl_action action compadd shell dump'
|
||||
|
||||
_apt-config () {
|
||||
local expl_action expl_shell_var expl_config_key
|
||||
_description actions expl_action 'action'
|
||||
_description parameters expl_shell_var 'shell variable to assign'
|
||||
_description configuration-keys expl_config_key 'configuration key'
|
||||
|
||||
_apt-config_sm
|
||||
}
|
||||
/"[]"/ ':argument-1:action:compadd "$expl[@]" shell dump'
|
||||
|
||||
_apt-config "$@"
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ _xset_compopts () {
|
|||
}
|
||||
|
||||
_xset_compfpadd () {
|
||||
_wanted directories expl directory _files -/
|
||||
_files "$expl[@]" -/
|
||||
}
|
||||
|
||||
_xset_compfpdel () {
|
||||
_wanted directories expl directory compadd - ${(s:,:)${"$(xset q)"##*
|
||||
compadd "$expl[@]" - ${(s:,:)${"$(xset q)"##*
|
||||
Font Path:
|
||||
#}%%
|
||||
*}
|
||||
|
@ -44,69 +44,70 @@ Font Path:
|
|||
|
||||
_regex_arguments _xset_parse \
|
||||
"/$word/" \
|
||||
\( "/-d(isplay|)$nul/" "$guard" "/$word/" ":_x_display" \
|
||||
\( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display "$expl[@]"' \
|
||||
\| "/-c$nul/" "$guard" \
|
||||
\| "/c$nul/" "$guard" \
|
||||
\( "/(on|off)$nul/" ':_wanted values expl click compadd on off' \
|
||||
\| "/[0-9]##$nul/" ':_message volume' \
|
||||
\( "/(on|off)$nul/" ':option-c-bool:click:compadd "$expl[@]" on off' \
|
||||
\| "/[0-9]##$nul/" ':option-c-volume:volume:_message volume' \
|
||||
\| \) \
|
||||
\| "/-b$nul/" "$guard" \
|
||||
\| "/b$nul/" "$guard" \
|
||||
\( "/(on|off)$nul/" ':_wanted values expl bell compadd on off' \
|
||||
\| "/[0-9]##$nul/" ':_message volume' \
|
||||
\( "/[0-9]##$nul/" ':_message pitch' \
|
||||
\( "/[0-9]##$nul/" ':_message duration' \
|
||||
\( "/(on|off)$nul/" ':option-b-bool:bell:compadd "$expl[@]" on off' \
|
||||
\| "/[0-9]##$nul/" ':option-b-volume:bell volume:_message volume' \
|
||||
\( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:_message pitch' \
|
||||
\( "/[0-9]##$nul/" ':option-b-duration:bell duration:_message duration' \
|
||||
\| \) \
|
||||
\| \) \
|
||||
\| \) \
|
||||
\| "/bc$nul/" "$guard" \
|
||||
\| "/-bc$nul/" "$guard" \
|
||||
\| "/fp$nul/" "$guard" "/$word/" ':_wanted values expl "font path" compadd default rehash' \
|
||||
\| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpadd' \
|
||||
\| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpdel' \
|
||||
\| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:compadd "$expl[@]" default rehash' \
|
||||
\| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:compset -P "*,"; _xset_compfpadd' \
|
||||
\| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:compset -P "*,"; _xset_compfpdel' \
|
||||
\| "/-led$nul/" "$guard" \
|
||||
\( "/[0-9]##$nul/" ':_message integer' \
|
||||
\( "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \
|
||||
\| \) \
|
||||
\| "/led$nul/" "$guard" \
|
||||
\( "/(on|off)$nul/" ':_wanted values expl led compadd on off' \
|
||||
\| "/[0-9]##$nul/" ':_message integer' \
|
||||
\( "/(on|off)$nul/" ':option-led-bool:led:compadd "$expl[@]" on off' \
|
||||
\| "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \
|
||||
\| \) \
|
||||
\| "/m(ouse|)$nul/" "$guard" \
|
||||
\( "/default$nul/" ':_wanted values expl "mouse parameter" compadd default' \
|
||||
\| "/[0-9]##(/[0-9]##|)$nul/" ':_message accel_mult/accel_div' \
|
||||
\( "/[0-9]##$nul/" ':_message threshold' \
|
||||
\( "/default$nul/" ':option-mouse-default:mouse parameter:compadd "$expl[@]" default' \
|
||||
\| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:_message accel_mult/accel_div' \
|
||||
\( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:_message threshold' \
|
||||
\| \) \
|
||||
\| \) \
|
||||
\| "/[-+]dpms$nul/" "$guard" \
|
||||
\| "/dpms$nul/" "$guard" \
|
||||
\( "/[0-9]##$nul/" ':_message "standby timeout"' \
|
||||
\( "/[0-9]##$nul/" ':_message "suspend timeout"' \
|
||||
\( "/[0-9]##$nul/" ':_message "off timeout"' \
|
||||
\( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:_message "standby timeout"' \
|
||||
\( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:_message "suspend timeout"' \
|
||||
\( "/[0-9]##$nul/" ':option-dpms-off:off timeout:_message "off timeout"' \
|
||||
\| \) \
|
||||
\| \) \
|
||||
\| "/(on|standby|suspend|off)$nul/" ':_wanted values expl DPMS compadd on standby suspend off' \
|
||||
\| "/force/" ':option-dpms-force:force DPMS state:compadd "$expl[@]" force' \
|
||||
"/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:compadd "$expl[@]" on standby suspend off' \
|
||||
\) \
|
||||
\| "/s$nul/" "$guard" \
|
||||
\( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
|
||||
':_wanted values expl "screen saver" compadd blank noblank expose noexpose default on activate reset off' \
|
||||
\| "/off$nul/" \( "/off$nul/" ':compadd off' \| \) \
|
||||
\| "/[0-9]##$nul/" ':_message length' \
|
||||
\( "/[0-9]##$nul/" ':_message period' \
|
||||
':option-s:screen saver:compadd "$expl[@]" blank noblank expose noexpose default on activate reset off' \
|
||||
\| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:compadd "$expl[@]" off' \| \) \
|
||||
\| "/[0-9]##$nul/" ':option-s-timeout:length:_message length' \
|
||||
\( "/[0-9]##$nul/" ':option-s-period:period:_message period' \
|
||||
\| \) \
|
||||
\| \) \
|
||||
\| "/-r$nul/" "$guard" \
|
||||
\( "/[0-9]##$nul/" ':_message keycode' \
|
||||
\( "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \
|
||||
\| \) \
|
||||
\| "/r$nul/" "$guard" \
|
||||
\( "/(on|off)$nul/" ':_wanted values expl autorepeat compadd on off' \
|
||||
\| "/[0-9]##$nul/" ':_message keycode' \
|
||||
\( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:compadd "$expl[@]" on off' \
|
||||
\| "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \
|
||||
\| \) \
|
||||
\| "/p$nul/" "$guard" \
|
||||
"/[0-9]##$nul/" ':_message pixel' \
|
||||
"/$word/" ':_x_color' \
|
||||
"/[0-9]##$nul/" ':option-p-pixel:pixel:_message pixel' \
|
||||
"/$word/" ':option-p-color:color:_x_color "$expl[@]"' \
|
||||
\| "/(-|)k$nul/" "$guard" \
|
||||
\| "/(-|)q$nul/" "$guard" \
|
||||
\| "/[]/" ':_xset_compopts' \
|
||||
\| "/[]/" ':options:options:_xset_compopts' \
|
||||
\) \#
|
||||
|
||||
_xset () {
|
||||
|
|
|
@ -15,34 +15,53 @@ _xwit_guard () {
|
|||
}
|
||||
|
||||
_xwit_compopts () {
|
||||
local expl
|
||||
_wanted options expl option compadd - ${(k)no[(R)*~0]} ||
|
||||
_wanted options expl option compadd - ${(k)no}
|
||||
compadd "$expl[@]" - ${(k)no[(R)*~0]} ||
|
||||
compadd "$expl[@]" - ${(k)no}
|
||||
}
|
||||
|
||||
_regex_arguments _xwit_parse \
|
||||
"/$word/" \
|
||||
\( \
|
||||
"/-/+" \
|
||||
\( "/display$nul/" "$guard" "/$word/" ":_x_display" \
|
||||
\( "/display$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \
|
||||
\| "/(sync|pop|open|iconify|unmap|root|current|select|(no|)(save|backingstore|saveunder))$nul/" "$guard" \
|
||||
\| "/resize$nul/" "$guard" "/$word/" ":_message width" "/$word/" ":_message height" \
|
||||
\| "/rows$nul/" "$guard" "/$word/" ":_message rows" \
|
||||
\| "/columns$nul/" "$guard" "/$word/" ":_message columns" \
|
||||
\| "/(r|)move$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
|
||||
\| "/(r|)warp$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
|
||||
\| "/colormap$nul/" "$guard" "/$word/" ":_x_colormapid" \
|
||||
\| "/(name|label)$nul/" "$guard" "/$word/" ":_x_name" \
|
||||
\| "/iconname$nul/" "$guard" "/$word/" ":_x_name" \
|
||||
\| "/bitmap$nul/" "$guard" "/$word/" ":_files -g \\*.xbm" \
|
||||
\| "/mask$nul/" "$guard" "/$word/" ":_files -g \\*.xbm" \
|
||||
\| "/iconmove$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
|
||||
\| "/id$nul/" "$guard" "/$word/" ":_x_window" \
|
||||
\| "/resize$nul/" "$guard" \
|
||||
"/$word/" ':option-resize-width:width:_message width' \
|
||||
"/$word/" ':option-resize-height:height:_message height' \
|
||||
\| "/rows$nul/" "$guard" "/$word/" ':option-rows:rows:_message rows' \
|
||||
\| "/columns$nul/" "$guard" "/$word/" ':option-columns:columns:_message columns' \
|
||||
\| "/move$nul/" "$guard" \
|
||||
"/$word/" ':option-move-x:x:_message x' \
|
||||
"/$word/" ':option-move-y:y:_message y' \
|
||||
\| "/rmove$nul/" "$guard" \
|
||||
"/$word/" ':option-rmove-x:x:_message x' \
|
||||
"/$word/" ':option-rmove-y:y:_message y' \
|
||||
\| "/warp$nul/" "$guard" \
|
||||
"/$word/" ':option-warp-x:x:_message x' \
|
||||
"/$word/" ':option-warp-y:y:_message y' \
|
||||
\| "/rwarp$nul/" "$guard" \
|
||||
"/$word/" ':option-rwarp-x:x:_message x' \
|
||||
"/$word/" ':option-rwarp-y:y:_message y' \
|
||||
\| "/colormap$nul/" "$guard" \
|
||||
"/$word/" ':option-colormap:colormapid:_x_colormapid' \
|
||||
\| "/(name|label)$nul/" "$guard" \
|
||||
"/$word/" ':option-name:name:_x_name "$expl[@]"' \
|
||||
\| "/iconname$nul/" "$guard" \
|
||||
"/$word/" ':option-name:iconname:_x_name "$expl[@]"' \
|
||||
\| "/bitmap$nul/" "$guard" \
|
||||
"/$word/" ':option-bitmap:bitmap file:_files "$expl[@]" -g \*.xbm' \
|
||||
\| "/mask$nul/" "$guard" \
|
||||
"/$word/" ':option-mask:mask file:_files "$expl[@]" -g \*.xbm' \
|
||||
\| "/iconmove$nul/" "$guard" \
|
||||
"/$word/" ':option-iconmove-x:x:_message x' \
|
||||
"/$word/" ':option-iconmove-y:y:_message y' \
|
||||
\| "/id$nul/" "$guard" "/$word/" ':option-id:window id:_x_window' \
|
||||
\| "/(no|)keyrepeat$nul/" "$guard" \
|
||||
\( "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message keycode" \
|
||||
\( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message 'last keycode'" \| \) \) \# \
|
||||
\| "/names$nul/" "$guard" "/$word/" ":_x_window -n" \# \
|
||||
\| "/[]/" ':_xwit_compopts' \
|
||||
\( "/[0-9]##$nul/" ':option-keyrepeat-keycode:keycode:[[ -prefix [0-9]# ]] && _message keycode' \
|
||||
\( "/-$nul/" "/[0-9]##$nul/" ':option-keyrepeat-last-keycode:last keycode:[[ -prefix [0-9]# ]] && _message "last keycode"' \| \) \) \# \
|
||||
\| "/names$nul/" "$guard" \
|
||||
"/$word/" ':option-names:window name:_x_window -n' \# \
|
||||
\| "/[]/" ':options:option:_xwit_compopts' \
|
||||
\) \
|
||||
\) \#
|
||||
|
||||
|
|
|
@ -3276,7 +3276,7 @@ metacharacters such as `tt(LPAR())', `tt(RPAR())', `tt(#)' and `tt(|)'
|
|||
should be quoted.
|
||||
|
||||
startitem()
|
||||
item(tt(/)var(pattern)tt(/) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
|
||||
item(tt(/)var(pattern)tt(/) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
|
||||
This is a primitive element, corresponding to one
|
||||
state of the compiled state machine. The state is entered if
|
||||
`tt((#b)LPAR()(#B))var(pattern)tt(RPAR()(#B))var(lookahead)tt(*)' matches
|
||||
|
@ -3295,12 +3295,15 @@ character, the completion target is restricted to the remainder of the
|
|||
command line string and var(action)s for the target are evaluated.
|
||||
In this case, nothing is actually removed from the command line string
|
||||
so that any previous or neighbouring state may also have var(actions)s.
|
||||
var(actions)s evaluation are ordered by the tt(tag-order) style and
|
||||
specified var(tag). var(descr) is used for set up the array parameter
|
||||
tt(expl).
|
||||
)
|
||||
item(tt(/)var(pattern)tt(/+) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
|
||||
item(tt(/)var(pattern)tt(/+) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
|
||||
This is similar to `tt(/)var(pattern)tt(/) ...' but the left part of
|
||||
command line string is also considered as part of the completion target.
|
||||
)
|
||||
item(tt(/)var(pattern)tt(/-) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
|
||||
item(tt(/)var(pattern)tt(/-) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
|
||||
This is similar to `tt(/)var(pattern)tt(/) ...' but the var(action)s of the
|
||||
current and previous states are ignored even if the following state's
|
||||
`var(pattern)' matches the empty string.
|
||||
|
|
1237
Src/Modules/zutil.c
1237
Src/Modules/zutil.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue