1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-06 06:51:33 +01:00

40965: fix for missing local declarations of expl

This commit is contained in:
Oliver Kiddle 2017-04-26 16:32:10 +02:00
parent 408b92b168
commit 78afb218b0
32 changed files with 109 additions and 58 deletions

View file

@ -1,3 +1,29 @@
2017-04-26 Oliver Kiddle <opk@zsh.org>
* 40965 (tweaked c.f. 40968): Completion/BSD/Command/_portmaster,
Completion/Debian/Command/_a2utils, Completion/Debian/Command/_apt,
Completion/Debian/Command/_lighttpd,
Completion/Debian/Command/_lintian,
Completion/Debian/Command/_wajig,
Completion/Debian/Type/_deb_architectures,
Completion/Debian/Type/_debbugs_bugnumber,
Completion/Linux/Command/_ethtool,
Completion/Solaris/Command/_svcadm,
Completion/Solaris/Command/_svccfg,
Completion/Solaris/Type/_svcs_fmri,
Completion/Unix/Command/_cdrdao, Completion/Unix/Command/_darcs,
Completion/Unix/Command/_iftop, Completion/Unix/Command/_lha,
Completion/Unix/Command/_lsof, Completion/Unix/Command/_pkg-config,
Completion/Unix/Command/_rrdtool, Completion/Unix/Command/_stgit,
Completion/Unix/Command/_tcpdump, Completion/Unix/Command/_texinfo,
Completion/Unix/Command/_units, Completion/Unix/Command/_yafc,
Completion/Unix/Type/_absolute_command_paths,
Completion/X/Command/_setxkbmap, Completion/X/Type/_xft_fonts,
Completion/Zsh/Command/_fc, Completion/Zsh/Context/_value,
Completion/Zsh/Function/_add-zle-hook-widget,
Completion/Zsh/Function/_add-zsh-hook:
fix for missing local declarations of expl
2017-04-26 Peter Stephenson <p.stephenson@samsung.com>
* 41008: Src/exec.c, Src/linklist.c, Test/A01grammar.ztst,

View file

@ -5,7 +5,7 @@ _portmaster_pkgs() {
}
_portmaster_ports() {
local ret=1 _fbsd_ports _fbsd_cat
local expl ret=1 _fbsd_ports _fbsd_cat
_fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t))
if [[ $PREFIX != */* ]] ; then
_wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat

View file

@ -1,6 +1,6 @@
#compdef a2ensite a2dissite a2enmod a2dismod
local -a mods
local -a expl mods
case "$service" in
a2ensite)
@ -21,4 +21,4 @@ case "$service" in
;;
esac
return 0
return

View file

@ -525,7 +525,7 @@ _apt-cache () {
--installed:bool \
-- \
/$'help\0'/ \| \
/$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files "$expl[@]"' \# \| \
/$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files' \# \| \
/$'gencaches\0'/ \| \
/$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
/$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
@ -595,10 +595,10 @@ _apt-config () {
/$'shell\0'/ \
\( \
/$'[^\0]#\0'/ ':parameters:shell variable to assign:_parameters' \
/$'[^\0]#\0'/ ':values:configuration key:compadd "$expl[@]" - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
/$'[^\0]#\0'/ ':values:configuration key:compadd - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
\) \# \| \
/$'dump\0'/ \| \
/"[]"/ ':argument-1:action:compadd "$expl[@]" shell dump'
/"[]"/ ':argument-1:action:compadd shell dump'
_apt-config "$@"
}

View file

@ -1,16 +1,16 @@
#compdef lighty-enable-mod lighty-disable-mod
local -a mods
local -a mods expl
case "$service" in
lighty-enable-mod)
mods=( `echo /etc/lighttpd/conf-available/*.conf(N:r:t) | sed -e 's/\b[0-9][0-9]-//g'` )
_wanted mods expl mods compadd -a mods
_wanted mods expl mod compadd -a mods
;;
lighty-disable-mod)
mods=( `echo /etc/lighttpd/conf-enabled/*.conf(N:r:t) | sed -e 's/\b[0-9][0-9]-//g'` )
_wanted mods expl mods compadd -a mods
_wanted mods expl mod compadd -a mods
;;
esac
return 0
return

View file

@ -1,6 +1,6 @@
#compdef lintian lintian-info
local line cmds ret=1
local curcontext="$curcontext" state line expl cmds ret=1
case "$service" in
(lintian)
@ -55,7 +55,7 @@ case "$service" in
(args)
case $line[1] in
-t|--tags)
_wanted tag expl 'tag' compadd $(command awk '/^Tag:/ { print $2 }' /usr/share/lintian/checks/*.desc) && ret=0
_wanted tags expl 'tag' compadd $(command awk '/^Tag:/ { print $2 }' /usr/share/lintian/checks/*.desc) && ret=0
;;
esac
;;

View file

@ -1,6 +1,6 @@
#compdef wajig
local curcontext="$curcontext" state line cmds argno ret=1
local curcontext="$curcontext" state line expl cmds argno ret=1
_arguments -C -s \
'(- 1 *)'{-h,--help}'[print usage message]' \

View file

@ -1,6 +1,6 @@
#autoload
local extra
local extra expl
zparseopts -E -D -a extra a:
_description architectures expl 'architecture'

View file

@ -1,6 +1,8 @@
#autoload
# TODO: use _describe with some basic metadata (e.g., bug title/package/version)
local expl
[[ $PREFIX$SUFFIX == [0-9]# ]] || return 1
# The cache directory moved; try both locations.

View file

@ -1,6 +1,6 @@
#compdef ethtool
local -a cmds
local -a expl cmds
if [[ $CURRENT -ge 4 ]]; then
case $words[CURRENT-1] in

View file

@ -1,7 +1,7 @@
#compdef svcadm
_svcadm() {
local context state line subcmds
local curcontext="$curcontext" state line expl subcmds
typeset -A opt_args
subcmds=( enable disable restart refresh mark delegate clear milestone )

View file

@ -14,7 +14,7 @@ _svccfg_properties() {
# Get all the property names for the FMRI
props=( ${${${(f)"$(svccfg -s $fmri describe)"}:# *}%% *} )
_multi_parts "$expl[@]" - / props
_multi_parts "$@" - / props
}
_svccfg() {

View file

@ -2,7 +2,7 @@
_svcs_fmri() {
local type="$argv[$#]"
local fmri_abbrevs m i
local fmri_abbrevs m i expl
typeset -a -g _smf_fmris
local update_policy

View file

@ -262,14 +262,14 @@ _cdrdao-copy () {
__cdrdao-device () {
# Use cdrdao scanbus and also check what OS we're running under and provide
# additional stuff, like devices (/dev/sg0)
local -a devices
local -a expl devices
devices=(${${(f)"$(_call_program devices cdrdao scanbus -v 0 2>&1)"}%% :*})
_wanted devices expl 'device' compadd -a devices
}
__cdrdao-drivers () {
local suf
local expl suf
local -Ua drivers
drivers=(${(f)"$(_call_program drivers cut -d'\|' -f4 /usr/share/cdrdao/drivers -s)"})
if compset -P \*:; then

View file

@ -13,6 +13,8 @@
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
local expl
if (($CURRENT == 2)); then
# We're completing the first word after "darcs" -- the command.
_wanted command expl 'darcs command' \

View file

@ -1,9 +1,16 @@
#compdef iftop
_interfaces () {
_wanted interfaces expl 'network interface' \
_net_interfaces
_values "Pseudo-device that captures on all interfaces" "any"
local disp expl sep
_description interfaces expl 'network interface'
_net_interfaces "$expl[@]"
if zstyle -t ":completion:${curcontext}:interfaces" verbose; then
zstyle -s ":completion:${curcontext}:interfaces" list-separator sep || sep=--
disp=( "any $sep capture on all interfaces" )
compadd "$expl[@]" -ld disp any
else
compadd "$expl[@]" any
fi
}
_arguments \
@ -14,7 +21,7 @@ _arguments \
-P'[turn on port display]' \
-b"[don't display bar graphs of traffic]" \
-B'[display bandwidth rates in bytes/sec rather than bits/sec]' \
-i'[interface]:network interface:_interfaces' \
-f'[filter]:BPF filter' \
-F'[net/mask]:network/mask' \
-c'[config file]:config file:_files'
'-i+[interface]:network interface:_interfaces' \
'-f+[filter]:BPF filter' \
'-F+[net/mask]:network/mask' \
'-c+[config file]:config file:_files'

View file

@ -1,5 +1,7 @@
#compdef lha
local expl
if (( CURRENT == 2 )); then
compset -P -

View file

@ -1,6 +1,6 @@
#compdef lsof
local curcontext="$curcontext" state line fields args
local curcontext="$curcontext" state line expl fields args
case $OSTYPE in
linux*) args=( '-X[skip reporting of info on network connections]' ) ;;

View file

@ -1,6 +1,6 @@
#compdef pkg-config
local arguments packages curcontext="$curcontext" state line ret=1
local arguments packages curcontext="$curcontext" state line expl ret=1
declare -A opt_args
# Up-to-date as of pkg-config 0.29-4 (debian package) man page synopsis

View file

@ -1,23 +1,25 @@
#compdef rrdtool
_arguments \
local curcontext="$curcontext" state line expl ret=1
_arguments -C \
':rrdtool command:(create update updatev graph dump restore
last lastupdate first help info fetch tune
resize xport)' \
'*::subcmd:->subcmd' && return 0
'*:: :->subcmds' && ret=0
curcontext="${curcontext%:*}-$words[1]:"
case "$state" in
(subcmd)
case "$words[1]" in
(subcmds)
case "$words[1]" in
(help)
_wanted -V 'subcommands' expl 'subcommand' compadd \
create update updatev graph dump restore last lastupdate \
first help info fetch tune resize xport
;;
_wanted -V 'subcommands' expl 'subcommand' compadd \
create update updatev graph dump restore last lastupdate \
first help info fetch tune resize xport
;;
(*)
_files
;;
esac
_files
;;
esac
;;
esac

View file

@ -4,7 +4,7 @@ typeset -a subcmds
subcmds=( ${${${(M)${(f)"$(stg help 2> /dev/null)"}## *}# }/#(#b)([^[:space:]]##)[[:space:]]##(*)/$match[1]:$match[2]} )
local curcontext="$curcontext"
local curcontext="$curcontext" expl
local subcmd
local ret=1
@ -18,17 +18,17 @@ else
case $subcmd in
(push)
_wanted -V "unapplied patches" expl "patch" \
_wanted -V unapplied-patches expl "patch" \
compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##- *}#- } \
&& ret=0
;;
(pop)
_wanted -V "applied patches" expl "patch" \
_wanted -V applied-patches expl "patch" \
compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \
&& ret=0
;;
(edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide|squash)
_wanted -V "patches" expl "patch" \
_wanted -V patches expl "patch" \
compadd $(stg series --noprefix 2> /dev/null) \
&& ret=0
;;
@ -36,7 +36,7 @@ else
last_word="$words[$CURRENT-1]"
refresh_patch_options=( -p --patch )
if [[ -n ${refresh_patch_options[(r)$last_word]} ]]; then
_wanted -V "applied patches" expl "patch" \
_wanted -V applied-patches expl "patch" \
compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \
&& ret=0
else

View file

@ -2,10 +2,17 @@
typeset -A opt_args
_interfaces () {
_wanted interfaces expl 'network interface' \
_net_interfaces
_values "Pseudo-device that captures on all interfaces" "any"
_interfaces() {
local disp expl sep
_description interfaces expl 'network interface'
_net_interfaces "$expl[@]"
if zstyle -t ":completion:${curcontext}:interfaces" verbose; then
zstyle -s ":completion:${curcontext}:interfaces" list-separator sep || sep=--
disp=( "any $sep capture on all interfaces" )
compadd "$expl[@]" -ld disp any
else
compadd "$expl[@]" any
fi
}
_esp_secrets () {

View file

@ -227,7 +227,7 @@ esac
if [[ -n $state ]]; then
local chr cache file q
local -a suf tags
local -a expl suf tags
local -i36 hash=5381
local -aU infopath=( /usr/share/info ${commands[info]:h:h}/share/info ${(s.:.)INFOPATH} $infodirs )
infopath=( $^infopath(N) )

View file

@ -1,6 +1,6 @@
#compdef units
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line expl
integer ret=1
typeset -A opt_args

View file

@ -30,7 +30,7 @@ _yafc_bookmarks() {
local bkmfile=~/.yafc/bookmarks
if [[ -f $bkmfile ]]; then
local -a bkms
local -a bkms expl
bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy
_wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms
fi

View file

@ -9,7 +9,7 @@ _hashed_absolute_command_paths() {
do
local -a matches=( "${(@)commands[(R)${~i}[^/]#]}" )
local -a descs=( $matches:t )
compadd -M "l:|=$i" -d descs "$expl[@]" -a matches
compadd -M "l:|=$i" -d descs "$@" -a matches
ret=0
done
return ret

View file

@ -55,7 +55,7 @@ _setxkbmap_files () {
local dir="$1"
local label="$2"
local -a fullpath shortpath
local -a fullpath shortpath expl
fullpath=($sourcedir/$dir/**/*~*README(.))
shortpath=(${fullpath#$sourcedir\/$dir\/})
@ -82,7 +82,7 @@ _setxkbmap_geometry () {
(( $+functions[_setxkbmap_variant] )) ||
_setxkbmap_variant () {
local file=$sourcedir/symbols/${1}
local -a variants lines
local -a variants lines expl
if [ ! -f $file ]; then
_message "no such layout: ${1}"

View file

@ -1,6 +1,6 @@
#compdef fc-list fc-match
local -a suf
local -a expl suf
local font=${${PREFIX//-[0-9]##:/:}%:*}: ret=1
local attr

View file

@ -1,6 +1,6 @@
#compdef fc history r
local curcontext="$curcontext" state state_descr line ret=1
local curcontext="$curcontext" state state_descr line expl ret=1
local num cmd sep
local -a events
typeset -A opt_args

View file

@ -24,6 +24,7 @@ else
if [[ "$compstate[parameter]" != *-* &&
"$compstate[context]" = *value &&
"${(Pt)${compstate[parameter]}}" = assoc* ]]; then
local expl
if (( CURRENT & 1 )); then
_wanted association-keys expl 'association key' \
compadd -k "$compstate[parameter]"

View file

@ -11,6 +11,7 @@ _add-zle-hook-widget_types() {
}
_add-zle-hook-widget_widgets() {
local expl
if (( $+opt_args[-d] )); then
local -a tmp
zstyle -g tmp $line[1] widgets

View file

@ -1,6 +1,7 @@
#compdef add-zsh-hook
_add-zsh-hook_hooks() {
local expl
if (( $+opt_args[-d] )); then
_wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0
else