mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 10:41:11 +02:00
zsh-workers:7512
This commit is contained in:
parent
1dc6ee079b
commit
a62f994ef9
1 changed files with 9 additions and 20 deletions
|
@ -7,7 +7,7 @@ setopt localoptions extendedglob
|
|||
|
||||
local long args rest ws cur nth def nm expl descr action opt arg tmp
|
||||
local single uns ret=1 soptseq soptseq1 sopts prefix line
|
||||
local beg optbeg argbeg nargbeg inopt
|
||||
local beg optbeg argbeg nargbeg inopt fromrest
|
||||
|
||||
# Associative arrays used to collect information about the options.
|
||||
|
||||
|
@ -226,11 +226,7 @@ while [[ cur -gt 0 ]]; do
|
|||
def="$opts[$ws[1]]"
|
||||
optbeg="$beg"
|
||||
argbeg="$beg"
|
||||
if [[ -n "$def" ]]; then
|
||||
inopt=yes
|
||||
else
|
||||
inopt=''
|
||||
fi
|
||||
inopt=yes
|
||||
[[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]"
|
||||
else
|
||||
uns=''
|
||||
|
@ -240,11 +236,7 @@ while [[ cur -gt 0 ]]; do
|
|||
def="$opts[$tmp]"
|
||||
optbeg="$beg"
|
||||
argbeg="$beg"
|
||||
if [[ -n "$def" ]]; then
|
||||
inopt=yes
|
||||
else
|
||||
inopt=''
|
||||
fi
|
||||
inopt=yes
|
||||
uns="${ws[1][2,-1]}"
|
||||
opt=''
|
||||
fi
|
||||
|
@ -285,13 +277,12 @@ while [[ cur -gt 0 ]]; do
|
|||
def="$dopts[$tmp[1]]"
|
||||
optbeg="$beg"
|
||||
argbeg="$beg"
|
||||
inopt=yes
|
||||
[[ -n "$oneshot[$tmp[1]]" ]] && unset "dopts[$tmp[1]]"
|
||||
if [[ "$def" = [^*]*[^\\]:*[^\\]:* ]]; then
|
||||
def="${def#?*[^\\]:*[^\\]:}"
|
||||
inopt=yes
|
||||
else
|
||||
def=''
|
||||
inopt=''
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -314,6 +305,7 @@ while [[ cur -gt 0 ]]; do
|
|||
def="$odopts[$tmp[1]]"
|
||||
optbeg="$beg"
|
||||
argbeg="$beg"
|
||||
inopt=yes
|
||||
[[ -n "$oneshot[$tmp[1]]" ]] && unset "odopts[$tmp[1]]"
|
||||
|
||||
# For options whose first argument *may* come after the
|
||||
|
@ -331,11 +323,6 @@ while [[ cur -gt 0 ]]; do
|
|||
def=''
|
||||
fi
|
||||
fi
|
||||
if [[ -n "$def" ]]; then
|
||||
inopt=yes
|
||||
else
|
||||
inopt=''
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -371,7 +358,7 @@ while [[ cur -gt 0 ]]; do
|
|||
(( beg++ ))
|
||||
done
|
||||
|
||||
[[ -n "$inopt" ]] && nargbeg="$beg"
|
||||
[[ -n "$inopt" ]] && nargbeg=$(( beg - 1 ))
|
||||
|
||||
# Now generate the matches.
|
||||
|
||||
|
@ -403,6 +390,7 @@ else
|
|||
def="$rest"
|
||||
optbeg="$nargbeg"
|
||||
argbeg="$nargbeg"
|
||||
fromrest=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -466,7 +454,8 @@ else
|
|||
(( $#tmp )) && unset "$tmp[@]"
|
||||
fi
|
||||
|
||||
if [[ -n "$opt" && "$def" != \** ]]; then
|
||||
if [[ -n "$opt" && ( "$def" != \** ||
|
||||
( -n "$fromrest" && CURRENT -eq argbeg+1 ) ) ]]; then
|
||||
|
||||
# We aren't in an argument directly after a option name, so
|
||||
# all option names are possible matches.
|
||||
|
|
Loading…
Reference in a new issue