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:
@ -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
|
||||
|
Reference in New Issue
Block a user