Skip to content

Commit

Permalink
basic code for includes
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmonsays committed Apr 1, 2024
1 parent b3f52d0 commit cc558e9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,35 @@ func (me *Link) RunConfig(opts *LinkOptions, cfg *AppConfig) error {
return err
}

err = me.ProcessIncludes(opts, cfg.Include, run)
if err != nil {
return err
}

return nil
}

func (me *Link) ProcessIncludes(opts *LinkOptions, includes []string, run *Run) error {
if len(includes) == 0 {
log.Tracef("no includes to process")
return nil
}
for _, include := range includes {

matches, err := filepath.Glob(include)
if err != nil {
log.Warnf("%s: %", include, err)
continue
}

for _, cfgfile := range matches {
err := me.RunFile(opts, cfgfile)
if err != nil {
log.Warnf("RunFile %s: %s", cfgfile, err)
continue
}
}
}
return nil
}

Expand Down

0 comments on commit cc558e9

Please sign in to comment.