From 53e4e28648aaad32f5197e44dd8ba9a7f4f5c6f5 Mon Sep 17 00:00:00 2001 From: PapaCharlie Date: Wed, 19 Jun 2019 17:52:10 -0700 Subject: [PATCH] Remove extra splat for zsh arrays It turns out that zsh will simply use the elements of an array as the parameters when referenced in the shell without quotes ``` % cat t.py import sys print sys.argv % typeset -a args % args+=("./t.py") % args+=("123 321") % $args ['./t.py', '123\n321'] ``` --- zsh_completions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh_completions.go b/zsh_completions.go index 444823d9..41b62643 100644 --- a/zsh_completions.go +++ b/zsh_completions.go @@ -91,7 +91,7 @@ function {{genZshFlagDynamicCompletionFuncName .}} { return $? fi - if ! error_message="$("${tokens[@]}" 2>&1 > "$output")" ; then + if ! error_message="$($tokens 2>&1 > "$output")" ; then local st="$?" _message "Exception occurred during completion: $error_message" return "$st" @@ -102,7 +102,7 @@ function {{genZshFlagDynamicCompletionFuncName .}} { args+="$line" done < "$output" - _values "$1" "$args[@]" + _values "$1" $args unset COBRA_FLAG_COMPLETION rm "$output"