Merge pull request #552 from justafish/justafish/519/optional-includes

Allow includes to be optional
This commit is contained in:
Andrey Nering
2021-09-25 09:36:44 -03:00
committed by GitHub
8 changed files with 93 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
includedTask = taskfile.IncludedTaskfile{
Taskfile: tr.Replace(includedTask.Taskfile),
Dir: tr.Replace(includedTask.Dir),
Optional: includedTask.Optional,
AdvancedImport: includedTask.AdvancedImport,
}
if err := tr.Err(); err != nil {
@@ -59,6 +60,9 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
}
info, err := os.Stat(path)
if err != nil && includedTask.Optional {
return nil
}
if err != nil {
return err
}