1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 17:10:59 +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

@ -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