diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-10 11:56:36 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-10 11:56:36 +0000 |
commit | d1fc7aafc77a15c150a139849536e1618f48ff94 (patch) | |
tree | fbdbbf72846f7a9927709cf5537567bd1d634f85 /Completion | |
parent | 3c9c93a727a7777374b5f3daf463e1659e65e9c2 (diff) | |
download | zsh-d1fc7aafc77a15c150a139849536e1618f48ff94.tar.gz zsh-d1fc7aafc77a15c150a139849536e1618f48ff94.tar.xz zsh-d1fc7aafc77a15c150a139849536e1618f48ff94.zip |
zsh-workers/9648
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Core/_files | 21 | ||||
-rw-r--r-- | Completion/Core/_multi_parts | 10 | ||||
-rw-r--r-- | Completion/Core/_path_files | 26 | ||||
-rw-r--r-- | Completion/Core/_sep_parts | 8 |
4 files changed, 30 insertions, 35 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files index f02ac7c38..ab35b7f05 100644 --- a/Completion/Core/_files +++ b/Completion/Core/_files @@ -3,10 +3,9 @@ local opts opt type=file glob group gopts dopts aopts tmp _file_pat_checked=yes local hasign ign -zparseopts \ - /tmp ftmp g+tmp \ - qopts nopts 1opts 2opts P:opts S:opts r:opts R:opts W:opts X:opts M:opts \ - F:opts J:group V:group +zparseopts -a opts \ + '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X: M: F: \ + 'J:=group' 'V:=group' type="${(@j::M)${(@)tmp#-}#?}" [[ -n "$type" ]] || type=f @@ -15,13 +14,15 @@ if (( $tmp[(I)-g*] )); then else gopts=() fi -(( $opts[(I)-F*] )) && hasign=yes +(( $opts[(I)-F] )) && hasign=yes -if [[ "$group[1]" = -?files ]]; then +if [[ "$group[2]" = files ]]; then opts=("$opts[@]" "$group[@]") group=() fi +ign=() + if zstyle -s ":completion:${curcontext}:all-files" file-patterns tmp && [[ -n "$tmp" ]]; then aopts=(-g "$tmp") @@ -58,7 +59,7 @@ esac while _tags; do if _requested all-files; then if (( $#group )); then - group[1]="${group[1][1,2]}all-files" + group[2]=all-files _setup all-files [[ -z "$hasign" ]] && zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore && @@ -69,7 +70,7 @@ while _tags; do elif _requested directories; then if _requested globbed-files; then if (( $#group )); then - group[1]="${group[1][1,2]}globbed-files" + group[2]=globbed-files _setup globbed-files [[ -z "$hasign" ]] && zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore && @@ -78,7 +79,7 @@ while _tags; do _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0 else if (( $#group )); then - group[1]="${group[1][1,2]}directories" + group[2]=directories _setup directories [[ -z "$hasign" ]] && zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore && @@ -88,7 +89,7 @@ while _tags; do fi elif _requested globbed-files; then if (( $#group )); then - group[1]="${group[1][1,2]}globbed-files" + group[2]=globbed-files _setup globbed-files [[ -z "$hasign" ]] && zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore && diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts index 61bd3acaf..6aa6da064 100644 --- a/Completion/Core/_multi_parts +++ b/Completion/Core/_multi_parts @@ -13,15 +13,13 @@ typeset -U tmp2 # Get the options. -zparseopts -D \ - J:group V:group X:expl \ - P:opts F:opts \ - S:sopts r:sopts R:sopts qsopts 1sopts 2sopts nsopts \ - M:match +zparseopts -D -a sopts \ + 'J:=group' 'V:=group' 'X:=expl' 'P:=opts' 'F:=opts' \ + S: r: R: q 1 2 n 'M:=match' sopts=( "$sopts[@]" "$opts[@]" ) if (( $#match )); then - match="${match[1][3,-1]}" + match="${match[2]}" else match='' fi diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 2e226eaf3..0ec311c64 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -17,11 +17,10 @@ exppaths=() # Get the options. -zparseopts \ - P:pfxsfx S:pfxsfx qpfxsfx r:pfxsfx R:pfxsfx \ - W:prepaths F:ignore M+matcher \ - J:mopts V:mopts X:mopts 1:mopts 2:mopts n:mopts \ - ftmp1 /tmp1 g+tmp1 +zparseopts -a mopts \ + 'P:=pfxsfx' 'S:=pfxsfx' 'q=pfxsfx' 'r:=pfxsfx' 'R:=pfxsfx' \ + 'W:=prepaths' 'F:=ignore' 'M+=matcher' \ + J: V: X: 1: 2: n: 'f=tmp1' '/=tmp1' 'g+:-=tmp1' sopt="-${(@j::M)${(@)tmp1#-}#?}" (( $tmp1[(I)-[/g]*] )) && haspats=yes @@ -33,7 +32,7 @@ else fi if (( $#prepaths )); then - tmp1="${prepaths[1][3,-1]}" + tmp1="${prepaths[2]}" if [[ "$tmp1[1]" = '(' ]]; then prepaths=( ${^=tmp1[2,-2]%/}/ ) elif [[ "$tmp1[1]" = '/' ]]; then @@ -48,15 +47,14 @@ else fi if (( $#ignore )); then - tmp1="${ignore[1][3,-1]}" - if [[ "$tmp1[1]" = '(' ]]; then - ignore=( ${=tmp1[2,-2]} ) + if [[ "${ignore[2]}" = \(* ]]; then + ignore=( ${=ignore[2][2,-2]} ) else - ignore=( ${(P)tmp1} ) + ignore=( ${(P)ignore[2]} ) fi fi -(( $#matcher )) && mspec="${matcher[1][3,-1]}" +(( $#matcher )) && mspec="${matcher[2]}" if [[ -z "$_file_pat_checked" ]] && zstyle -s ":completion:${curcontext}:files" file-patterns tmp1 && @@ -84,7 +82,7 @@ if [[ "$sopt" = -(f|) ]]; then fi fi -if (( ! $mopts[(I)-[JVX]*] )); then +if (( ! $mopts[(I)-[JVX]] )); then local expl if [[ -z "$gopt" && "$sopt" = -/ ]]; then @@ -165,7 +163,7 @@ eorig="$orig" if (( $#ignore )); then _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" ) - (( $mopts[(I)-F*] )) || mopts=( "$mopts[@]" -F _comp_ignore ) + (( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore ) fi # Now let's have a closer look at the string to complete. @@ -371,7 +369,7 @@ for prepath in "$prepaths[@]"; do [[ "$i" -ef "$PWD" ]] && _comp_ignore=( "$_comp_ignore[@]" "${(q)i}" ) done fi - (( $#_comp_ignore && $mopts[(I)-F*] )) || mopts=( "$mopts[@]" -F _comp_ignore ) + (( $#_comp_ignore && $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore ) fi # Step over to the next component, if any. diff --git a/Completion/Core/_sep_parts b/Completion/Core/_sep_parts index cff34db0c..f3b73444e 100644 --- a/Completion/Core/_sep_parts +++ b/Completion/Core/_sep_parts @@ -22,13 +22,11 @@ local matchflags opt group expl nm=$compstate[nmatches] opre osuf opts match # Get the options. -zparseopts -D \ - J:group V:group \ - P:opts F:opts S:opts r:opts R:opts qopts 1opts 2opts nopts \ - X:expl M:match +zparseopts -D -a opts \ + 'J:=group' 'V=:group' P: F: S: r: R: q 1 2 n 'X:=expl' 'M:=match' if (( $#match )); then - match="${match[1][3,-1]}" + match="${match[2]}" else match='' fi |