From e50c0771b79efc8e6fe600aa797dec424fd4a36c Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 13 Mar 2020 16:38:01 -0400 Subject: [PATCH] feat(comp): Allow to inject commandline for tests By allowing to specify the commandLine for completion, it becomes possible to have regression tests for fish completion. These tests are part of the acceptance-testing repo. Signed-off-by: Marc Khouzam --- cmd/helm/completion.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index b1678453c..07c882516 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -304,7 +304,13 @@ end function __helm_get_completions # Use the cache if possible if not set -q __helm_cache_completions - set -g __helm_cache_completions (__helm_perform_completion (commandline)) + if not set -q __helm_comp_command_line + set -g __helm_comp_command_line (commandline) + __helm_debug "Setting commandline to: $__helm_comp_command_line" + end + + set -g __helm_cache_completions (__helm_perform_completion "$__helm_comp_command_line") + set -e __helm_comp_command_line __helm_debug "Populated completion cache with: $__helm_cache_completions" end