1
0
mirror of https://github.com/go-task/task.git synced 2025-06-27 00:51:05 +02:00

initial pass at deferred commands

This commit is contained in:
Jacob McCollum
2021-12-15 00:03:37 -05:00
parent 1c782c599f
commit 69e9effc88
6 changed files with 78 additions and 0 deletions

View File

@ -7,6 +7,7 @@ type Cmd struct {
Task string
Vars *Vars
IgnoreError bool
Defer bool
}
// Dep is a task dependency
@ -33,6 +34,18 @@ func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
c.IgnoreError = cmdStruct.IgnoreError
return nil
}
var deferredCmd struct {
Defer string
}
if err := unmarshal(&deferredCmd); err == nil && deferredCmd.Defer != "" {
c.Defer = true
if strings.HasPrefix(deferredCmd.Defer, "^") {
c.Task = strings.TrimPrefix(deferredCmd.Defer, "^")
} else {
c.Cmd = deferredCmd.Defer
}
return nil
}
var taskCall struct {
Task string
Vars *Vars