From ce90081ea88b97130f6c6758686711bc21c9ab3a Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 22 May 2000 09:28:34 +0000 Subject: pat(-) in long-option patterns to say that argument should be completed only after the `='; merge _arguments and _argument_sets; slightly better test when not to complete options (11489) --- Completion/Base/_argument_sets | 86 ------------------------------------------ 1 file changed, 86 deletions(-) delete mode 100644 Completion/Base/_argument_sets (limited to 'Completion/Base/_argument_sets') diff --git a/Completion/Base/_argument_sets b/Completion/Base/_argument_sets deleted file mode 100644 index f8a55dad9..000000000 --- a/Completion/Base/_argument_sets +++ /dev/null @@ -1,86 +0,0 @@ -#autoload - -local all ret=1 end xor has_args had_args ostate ocontext oopt_args r -local nm="$compstate[nmatches]" -local opre="$PREFIX" oipre="$IPREFIX" ocur="$CURRENT" -local osuf="$SUFFIX" oisuf="$ISUFFIX" owords -local _ms_match _ms_opt _ms_soptmid _ms_soptmidadd _ms_soptend -local _ms_optnext _ms_optdirect _ms_optequal - -_ms_soptmid=() -_ms_soptmidadd=() -_ms_soptend=() -_ms_optnext=() -_ms_optdirect=() -_ms_optequal=() - -owords=("$words[@]") - -end=$argv[(i)-] -[[ end -gt $# ]] && return 1 - -all=( "${(@)argv[1,end]}" ) - -shift end - -xor=() -ostate=() -ocontext=() -oopt_args=() - -while true; do - end=$argv[(i)-] - - if [[ "$1" = \(*\) ]]; then - _arguments -m xor "${1[2,-2]}" "$all[@]" \ - "$1${(@)^argv[2,end-1]:#\(*}" \ - "${1[1,-2]} ${(@)${(@M)^argv[2,end-1]:#\(*}#?}" - else - _arguments -m xor "$1" "$all[@]" "${(@)argv[2,end-1]}" - fi - - r=$? - - oopt_args=( "$oopt_args[@]" "${(@kv)opt_args}" ) - if [[ r -eq 300 ]]; then - ret=300 - ostate=( "$ostate[@]" "$state[@]" ) - ocontext=( "$ocontext[@]" "$context[@]" ) - PREFIX="$opre" SUFFIX="$osuf" - IPREFIX="$oipre" ISUFFIX="$oisuf" - CURRENT="$ocur" words=( "$owords[@]" ) - elif [[ "$r$ret" = 01 ]]; then - ret=0 - fi - - [[ end -gt $# ]] && break - - shift end -done - -[[ -n "$_ms_opt" ]] && - { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || - [[ "$PREFIX" = [-+]* || - ( -z "$has_args" && ret -ne 300 && nm -eq compstate[nmatches] ) ]] } && - has_args=yes && - _describe -o option \ - _ms_soptmid _ms_soptmidadd -Q -S '' -- \ - _ms_soptend -Q -- \ - _ms_optnext -Q -M "$_ms_match" -- \ - _ms_optdirect -QS '' -M "$_ms_match" -- \ - _ms_optequal -QqS= -M "$_ms_match" && [[ ret -eq 1 ]] && ret=0 - -opt_args=( "$oopt_args[@]" ) - -if [[ ret -eq 300 ]]; then - state=( "$ostate[@]" ) - context=( "$ocontext[@]" ) -elif [[ -z "$has_args" ]]; then - if [[ -n "$had_args" ]]; then - _message "no more arguments" - else - _message "no arguments" - fi -fi - -return ret -- cgit 1.4.1