diff options
author | Matthew Martin <phy1729@gmail.com> | 2019-04-22 22:04:24 -0500 |
---|---|---|
committer | Matthew Martin <phy1729@gmail.com> | 2019-04-22 22:04:24 -0500 |
commit | 39b0f5540c624f11d087632ae2d67a113d84a773 (patch) | |
tree | 1b780a38b32aebbcfbe9d6b61cdf12dcb021c803 /Completion/Base | |
parent | a4f44972076ac86bde7f8b96c18b10807d580965 (diff) | |
download | zsh-39b0f5540c624f11d087632ae2d67a113d84a773.tar.gz zsh-39b0f5540c624f11d087632ae2d67a113d84a773.tar.xz zsh-39b0f5540c624f11d087632ae2d67a113d84a773.zip |
unposted: _pick_variant: Use ${(P) ::= rather than eval
Diffstat (limited to 'Completion/Base')
-rw-r--r-- | Completion/Base/Utility/_pick_variant | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Completion/Base/Utility/_pick_variant b/Completion/Base/Utility/_pick_variant index b75233038..9d705cf10 100644 --- a/Completion/Base/Utility/_pick_variant +++ b/Completion/Base/Utility/_pick_variant @@ -17,7 +17,7 @@ done if (( ${#precommands:|builtin_precommands} )); then pre=command elif (( $+opts[-b] && ( $precommands[(I)builtin] || $+builtins[$opts[-c]] ) )); then - (( $+opts[-r] )) && eval "${opts[-r]}=$opts[-b]" + (( $+opts[-r] )) && : ${(P)opts[-r]::=$opts[-b]} return 0 elif (( $precommands[(I)builtin] )); then pre=builtin @@ -28,7 +28,7 @@ else fi if [[ $pre != builtin ]] && (( $+_cmd_variant[$opts[-c]] )); then - (( $+opts[-r] )) && eval "${opts[-r]}=${_cmd_variant[$opts[-c]]}" + (( $+opts[-r] )) && : ${(P)opts[-r]::=${_cmd_variant[$opts[-c]]}} [[ $_cmd_variant[$opts[-c]] = "$1" ]] && return 1 return 0 fi @@ -37,13 +37,13 @@ output="$(_call_program variant $pre $opts[-c] "${@[2,-1]}" </dev/null 2>&1)" for cmd pat in "$var[@]"; do if [[ $output = *$~pat* ]]; then - (( $+opts[-r] )) && eval "${opts[-r]}=$cmd" + (( $+opts[-r] )) && : ${(P)opts[-r]::=$cmd} _cmd_variant[$opts[-c]]="$cmd" return 0 fi done -(( $+opts[-r] )) && eval "${opts[-r]}=$1" +(( $+opts[-r] )) && : ${(P)opts[-r]::=$1} [[ $pre != builtin ]] && _cmd_variant[$opts[-c]]="$1" return 1 |