1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Variable handling

Relates to #2
This commit is contained in:
Sascha Andres
2017-03-02 10:46:20 +01:00
parent b325b506c9
commit 240589978d
2 changed files with 50 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ type Task struct {
Sources []string
Generates []string
Dir string
Variables map[string]string
}
type taskNotFoundError struct {
@@ -101,14 +102,16 @@ func RunTask(name string) error {
return nil
}
vars := t.handleVariables()
for _, d := range t.Deps {
if err := RunTask(d); err != nil {
if err := RunTask(ReplaceVariables(d, vars)); err != nil {
return err
}
}
for _, c := range t.Cmds {
if err := runCommand(c, t.Dir); err != nil {
if err := runCommand(ReplaceVariables(c, vars), ReplaceVariables(t.Dir, vars)); err != nil {
return &taskRunError{name, err}
}
}