Added support for pre and post commands
Two new fields were added to the config. Precmds runs before cmds and links. Postcmds runs after cmds and links. Cmds is no longer necessary but was left in for compatibility.
This commit is contained in:
parent
6994b1781d
commit
66eb33b724
32
task.go
32
task.go
@ -28,12 +28,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type task struct {
|
type task struct {
|
||||||
Deps []string
|
Deps []string
|
||||||
Links [][]string
|
Links [][]string
|
||||||
Cmds [][]string
|
Precmds [][]string
|
||||||
Envs [][]string
|
Cmds [][]string
|
||||||
Accepts [][]string
|
Postcmds [][]string
|
||||||
Rejects [][]string
|
Envs [][]string
|
||||||
|
Accepts [][]string
|
||||||
|
Rejects [][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *task) deps(conf *config) []string {
|
func (t *task) deps(conf *config) []string {
|
||||||
@ -61,6 +63,14 @@ func (t *task) process(conf *config) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conf.flags&flagNoCmds == 0 {
|
||||||
|
for _, currCmd := range t.Precmds {
|
||||||
|
if err := processCmd(currCmd, true, conf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if conf.flags&flagNoCmds == 0 {
|
if conf.flags&flagNoCmds == 0 {
|
||||||
for _, currCmd := range t.Cmds {
|
for _, currCmd := range t.Cmds {
|
||||||
if err := processCmd(currCmd, true, conf); err != nil {
|
if err := processCmd(currCmd, true, conf); err != nil {
|
||||||
@ -77,7 +87,15 @@ func (t *task) process(conf *config) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
if conf.flags&flagNoCmds == 0 {
|
||||||
|
for _, currCmd := range t.Postcmds {
|
||||||
|
if err := processCmd(currCmd, true, conf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *task) skippable(conf *config) bool {
|
func (t *task) skippable(conf *config) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user