Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,16 @@ func (c *Compiler) getSpecialVars(t *ast.Task, call *Call) (map[string]string, e
allVars["TASK_DIR"] = filepathext.SmartJoin(c.Dir, t.Dir)
allVars["TASKFILE"] = t.Location.Taskfile
allVars["TASKFILE_DIR"] = filepath.Dir(t.Location.Taskfile)
} else {
allVars["TASK"] = ""
allVars["TASK_DIR"] = ""
allVars["TASKFILE"] = ""
allVars["TASKFILE_DIR"] = ""
}
if call != nil {
allVars["ALIAS"] = call.Task
} else {
allVars["ALIAS"] = ""
}

return allVars, nil
Expand Down
4 changes: 4 additions & 0 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ func (e *Executor) setupCompiler() error {
}

func (e *Executor) readDotEnvFiles() error {
if e.Taskfile == nil || len(e.Taskfile.Dotenv) == 0 {
return nil
}

if e.Taskfile.Version.LessThan(ast.V3) {
return nil
}
Expand Down
4 changes: 0 additions & 4 deletions taskfile/dotenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import (
)

func Dotenv(vars *ast.Vars, tf *ast.Taskfile, dir string) (*ast.Vars, error) {
if len(tf.Dotenv) == 0 {
return nil, nil
}

env := ast.NewVars()
cache := &templater.Cache{Vars: vars}

Expand Down
Loading