feat: support negative globs (#1324)

Co-authored-by: Andrey Nering <andrey@nering.com.br>
This commit is contained in:
Pete Davison
2023-11-29 19:38:12 -06:00
committed by GitHub
parent a7958c0e3b
commit ec35d43677
14 changed files with 173 additions and 50 deletions

View File

@@ -80,6 +80,21 @@ func (r *Templater) ReplaceSlice(strs []string) []string {
return new
}
func (r *Templater) ReplaceGlobs(globs []*taskfile.Glob) []*taskfile.Glob {
if r.err != nil || len(globs) == 0 {
return nil
}
new := make([]*taskfile.Glob, len(globs))
for i, g := range globs {
new[i] = &taskfile.Glob{
Glob: r.Replace(g.Glob),
Negate: g.Negate,
}
}
return new
}
func (r *Templater) ReplaceVars(vars *taskfile.Vars) *taskfile.Vars {
return r.replaceVars(vars, nil)
}