summaryrefslogtreecommitdiff
path: root/gomplate.go
diff options
context:
space:
mode:
authorGeorge Kelly <gdog.kelly@googlemail.com>2017-11-27 19:48:31 +0000
committerGeorge Kelly <gdog.kelly@googlemail.com>2017-11-27 20:04:33 +0000
commit2e96ae1c9bde571978c30430dcd6e3f5f9807f43 (patch)
treec128462abbb9c1a004590cc6d96185f8de0b00b0 /gomplate.go
parent0e33e6fc712d31b742f470cc69d4166c2804ee5e (diff)
Can now take multiple exclude flags
Diffstat (limited to 'gomplate.go')
-rw-r--r--gomplate.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/gomplate.go b/gomplate.go
index 45cb2548..d1c6bb68 100644
--- a/gomplate.go
+++ b/gomplate.go
@@ -46,7 +46,7 @@ func runTemplate(o *GomplateOpts) error {
g := NewGomplate(d, o.lDelim, o.rDelim)
- excludeList, err := filepath.Glob(o.excludeGlob)
+ excludeList, err := executeCombinedGlob(o.excludeGlob)
if err != nil {
return err
}
@@ -69,3 +69,19 @@ func renderTemplate(g *Gomplate, inString string, outPath string) error {
err = g.RunTemplate(inString, outFile)
return err
}
+
+// takes an array of glob strings and executes it as a whole,
+// returning a merged list of globbed files
+func executeCombinedGlob(globArray []string) ([]string, error) {
+ var combinedExcludes []string
+ for _, glob := range globArray {
+ excludeList, err := filepath.Glob(glob)
+ if err != nil {
+ return nil, err
+ }
+
+ combinedExcludes = append(combinedExcludes, excludeList...)
+ }
+
+ return combinedExcludes, nil
+}