diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-01-21 16:13:15 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-01-21 16:13:15 +0000 |
commit | f463b09b133f8c798750334558b99d633c1a2219 (patch) | |
tree | 0f203d91189b49d084fee0cd32d6dc77b9a935b2 /Completion | |
parent | 4f6493aff1b41e314c2ca6adf3c374b093291c21 (diff) | |
download | zsh-f463b09b133f8c798750334558b99d633c1a2219.tar.gz zsh-f463b09b133f8c798750334558b99d633c1a2219.tar.xz zsh-f463b09b133f8c798750334558b99d633c1a2219.zip |
allow arguments to be given to functions used by compdef (actually, the strings are eval'uated, so this should be powerful enough) (16472)
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Completer/_complete | 10 | ||||
-rw-r--r-- | Completion/Base/Core/_normal | 6 | ||||
-rw-r--r-- | Completion/Base/Utility/_contexts | 10 | ||||
-rw-r--r-- | Completion/Unix/Command/_su | 6 |
4 files changed, 18 insertions, 14 deletions
diff --git a/Completion/Base/Completer/_complete b/Completion/Base/Completer/_complete index 28bb008ca..98d293175 100644 --- a/Completion/Base/Completer/_complete +++ b/Completion/Base/Completer/_complete @@ -85,7 +85,7 @@ if [[ -n "$compcontext" ]]; then ccarray[3]="$compcontext" comp="$_comps[$compcontext]" - [[ -z "$comp" ]] || "$comp" + [[ -n "$comp" ]] && eval "$comp" fi return @@ -94,10 +94,10 @@ fi # An entry for `-first-' is the replacement for `compctl -T' comp="$_comps[-first-]" -if [[ ! -z "$comp" ]]; then +if [[ -n "$comp" ]]; then service="${_services[-first-]:--first-}" ccarray[3]=-first- - "$comp" && ret=0 + eval "$comp" && ret=0 if [[ "$_compskip" = all ]]; then _compskip= return ret @@ -135,8 +135,8 @@ else fi comp="$_comps[-default-]" fi - [[ -z "$comp" ]] || - service="${_services[-default-]:--default-}" && "$comp" && ret=0 + [[ -n "$comp" ]] && + service="${_services[-default-]:--default-}" && eval "$comp" && ret=0 fi _compskip= diff --git a/Completion/Base/Core/_normal b/Completion/Base/Core/_normal index 364a56764..9ddfab1cd 100644 --- a/Completion/Base/Core/_normal +++ b/Completion/Base/Core/_normal @@ -19,7 +19,7 @@ if [[ CURRENT -eq 1 ]]; then curcontext="${curcontext%:*:*}:-command-:" comp="$_comps[-command-]" - [[ -z "$comp" ]] || "$comp" && ret=0 + [[ -n "$comp" ]] && eval "$comp" && ret=0 return ret else @@ -86,7 +86,7 @@ service="${_services[$cmd1]:-$cmd1}" if [[ -n "$comp" ]]; then _compskip=patterns - "$comp" && ret=0 + eval "$comp" && ret=0 [[ "$_compskip" = (all|*patterns*) ]] && return ret elif [[ "$_compskip" != *default* ]]; then name=-default- @@ -121,7 +121,7 @@ if [[ "$_compskip" != (all|*patterns*) ]]; then fi [[ "$name" = -default- && -n "$comp" && "$_compskip" != (all|*default*) ]] && - service="${_services[-default-]:--default-}" && "$comp" && ret=0 + service="${_services[-default-]:--default-}" && eval "$comp" && ret=0 _compskip='' diff --git a/Completion/Base/Utility/_contexts b/Completion/Base/Utility/_contexts index 680f2019f..f0e5ba874 100644 --- a/Completion/Base/Utility/_contexts +++ b/Completion/Base/Utility/_contexts @@ -7,11 +7,17 @@ # `_contexts -math-' to get the completions that would be generated for a # mathematical context. -local i tmp ret=1 service +local i tmp ret=1 service or + +if [[ $1 = -o ]]; then + or=yes + shift +fi for i; do tmp="$_comps[$i]" - [[ -z "$tmp" ]] || service="${_services[$i]:-$i}" && "$tmp" && ret=0 + [[ -n "$tmp" ]] && service="${_services[$i]:-$i}" && eval "$tmp" && ret=0 + [[ -n "$or" && ret -eq 0 ]] && return 0 done return ret diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index daf301555..d8ed17183 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -16,7 +16,5 @@ fi shell="${${(M@)${(@f)$(</etc/passwd)}:#$usr*}##*:}" compset -n $base -for name in $shell $shell:t -default-; do - comp="$_comps[$name]" - [[ -n "$comp" ]] && "$comp" && return -done + +_contexts -o $shell $shell:t -default- |