From 32ca64c50a0080198a924c4d9f7c18637b4a76f4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 May 2017 17:24:36 +0200 Subject: [PATCH] feat templater: Warn if no valid resource sets are included After filtering resource sets, check whether any resource sets "survived". Otherwise it can be assumed that the user specified invalid exclude/include combinations and should be warned about that. Fixes #35 --- templater/templater.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templater/templater.go b/templater/templater.go index 67e33a535..9a00da3a7 100644 --- a/templater/templater.go +++ b/templater/templater.go @@ -33,6 +33,11 @@ type TemplatingError struct { func LoadAndPrepareTemplates(include *[]string, exclude *[]string, c *context.Context) (output []string, err error) { limitedResourceSets := applyLimits(&c.ResourceSets, include, exclude) + if len(*limitedResourceSets) == 0 { + fmt.Fprintln(os.Stderr, "No valid resource sets included!") + return + } + for _, rs := range *limitedResourceSets { err = processResourceSet(c, &rs, &output)