From 4f4779ca3a456468851f446fd978c4c71563fa96 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sat, 25 Jan 2020 12:42:21 -0500 Subject: [PATCH] fix(comp): Allow zsh completion to handle -n flag When doing zsh completion, the -n flag would not be handled properly. Doing helm -n would not add the space after the -n. This was caused by the fact that the -n flag was being swallowed by the echo command. To fix this, we use printf instead. Signed-off-by: Marc Khouzam --- cmd/helm/completion.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index a44140d9f..1601cb448 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -139,7 +139,10 @@ __helm_compgen() { fi for w in "${completions[@]}"; do if [[ "${w}" = "$1"* ]]; then - echo "${w}" + # Use printf instead of echo beause it is possible that + # the value to print is -n, which would be interpreted + # as a flag to echo + printf "%s\n" "${w}" fi done }