From 0e33e6fc712d31b742f470cc69d4166c2804ee5e Mon Sep 17 00:00:00 2001 From: George Kelly Date: Mon, 30 Oct 2017 22:14:45 +0000 Subject: Can now pass --exclude as a flag exclude takes a glob and ensures that any files found in that glob aren't parsed --- gomplate.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gomplate.go') diff --git a/gomplate.go b/gomplate.go index fcc5792f..45cb2548 100644 --- a/gomplate.go +++ b/gomplate.go @@ -2,6 +2,7 @@ package main import ( "io" + "path/filepath" "text/template" "github.com/hairyhenderson/gomplate/data" @@ -45,11 +46,16 @@ func runTemplate(o *GomplateOpts) error { g := NewGomplate(d, o.lDelim, o.rDelim) + excludeList, err := filepath.Glob(o.excludeGlob) + if err != nil { + return err + } + if o.inputDir != "" { - return processInputDir(o.inputDir, o.outputDir, g) + return processInputDir(o.inputDir, o.outputDir, excludeList, g) } - return processInputFiles(o.input, o.inputFiles, o.outputFiles, g) + return processInputFiles(o.input, o.inputFiles, o.outputFiles, excludeList, g) } // Called from process.go ... -- cgit v1.2.3