From eb10e4359217bc8c366924e834295d0d4a31505a Mon Sep 17 00:00:00 2001 From: Mario Valderrama Date: Wed, 25 Mar 2020 13:36:51 +0100 Subject: [PATCH] Improve --show-only flag Signed-off-by: Mario Valderrama --- cmd/helm/template.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index bd14cde1d..7200b2e3b 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -104,10 +104,19 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { // if the filepath provided matches a manifest path in the // chart, render that manifest - if f == manifestPath { - manifestsToRender = append(manifestsToRender, manifest) - missing = false + if strings.HasSuffix(f, "*") { + if matched, _ := filepath.Match(f, manifestPath); !matched { + continue + } + } else if strings.HasSuffix(f, "/") { + if dir, _ := filepath.Split(manifestPath); f != dir { + continue + } + } else if f != manifestPath { + continue } + manifestsToRender = append(manifestsToRender, manifest) + missing = false } if missing { return fmt.Errorf("could not find template %s in chart", f)