mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
Add Preconditions to Tasks
This commit is contained in:
11
variables.go
11
variables.go
@@ -73,6 +73,7 @@ func (e *Executor) CompiledTask(call taskfile.Call) (*taskfile.Task, error) {
|
||||
IgnoreError: cmd.IgnoreError,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if len(origTask.Deps) > 0 {
|
||||
new.Deps = make([]*taskfile.Dep, len(origTask.Deps))
|
||||
@@ -83,6 +84,16 @@ func (e *Executor) CompiledTask(call taskfile.Call) (*taskfile.Task, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(origTask.Precondition) > 0 {
|
||||
new.Precondition = make([]*taskfile.Precondition, len(origTask.Precondition))
|
||||
for i, precond := range origTask.Precondition {
|
||||
new.Precondition[i] = &taskfile.Precondition{
|
||||
Sh: r.Replace(precond.Sh),
|
||||
Msg: r.Replace(precond.Msg),
|
||||
IgnoreError: precond.IgnoreError,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &new, r.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user