Merge branch 'tridentlead-master'
This commit is contained in:
commit
4c98383b21
11
README.md
11
README.md
@ -223,11 +223,12 @@ shown below:
|
|||||||
|
|
||||||
Homemaker will process the dependency tasks before processing the task itself.
|
Homemaker will process the dependency tasks before processing the task itself.
|
||||||
|
|
||||||
In addition to creating links, Homemaker is capable of executing commands on a per-task basis. Commands should be
|
In addition to creating links, Homemaker is capable of executing commands on a per-task basis. Homemaker can commands both
|
||||||
defined in an array called `cmds`, split into an item per each command line argument. All of the commands are executed
|
before and after linking your configuration. Commands should be placed in either an array, under the field `precmds` or
|
||||||
with `dest` as the working directory (as mentioned previously, this defaults to your home directory). If any command
|
`postcmds` (for commands to be run before and after linking respectively). These commands should be split into an array of
|
||||||
returns a nonzero exit code, Homemaker will display an error message and prompt the user to determine if it should
|
strings, with each entry corresponding to one command line argument. All of the commands are executed with `dest` as
|
||||||
*abort*, *retry*, or *cancel*.
|
the working directory (as mentioned previously, this defaults to your home directory). If any command returns a nonzero
|
||||||
|
exit code, Homemaker will display an error message and prompt the user to determine if it should *abort*, *retry*, or *cancel*.
|
||||||
|
|
||||||
The example task below will clone and install configuration files for Vim into the `~/.config` directory, and create
|
The example task below will clone and install configuration files for Vim into the `~/.config` directory, and create
|
||||||
links to it from the home directory. You may notice that this task references an environment variable (set by Homemaker
|
links to it from the home directory. You may notice that this task references an environment variable (set by Homemaker
|
||||||
|
15
task.go
15
task.go
@ -30,7 +30,9 @@ import (
|
|||||||
type task struct {
|
type task struct {
|
||||||
Deps []string
|
Deps []string
|
||||||
Links [][]string
|
Links [][]string
|
||||||
|
CmdsPre [][]string
|
||||||
Cmds [][]string
|
Cmds [][]string
|
||||||
|
CmdsPost [][]string
|
||||||
Envs [][]string
|
Envs [][]string
|
||||||
Accepts [][]string
|
Accepts [][]string
|
||||||
Rejects [][]string
|
Rejects [][]string
|
||||||
@ -62,6 +64,11 @@ func (t *task) process(conf *config) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if conf.flags&flagNoCmds == 0 {
|
if conf.flags&flagNoCmds == 0 {
|
||||||
|
for _, currCmd := range t.CmdsPre {
|
||||||
|
if err := processCmd(currCmd, true, conf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
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 {
|
||||||
return err
|
return err
|
||||||
@ -77,6 +84,14 @@ func (t *task) process(conf *config) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conf.flags&flagNoCmds == 0 {
|
||||||
|
for _, currCmd := range t.CmdsPost {
|
||||||
|
if err := processCmd(currCmd, true, conf); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user