Add support for environment variable expansion in dependencies
This commit is contained in:
parent
87f1a4e15c
commit
e2474969bd
10
README.md
10
README.md
@ -248,11 +248,11 @@ itself) in the `links` block; you can read more about how to use environment var
|
||||
|
||||
### Environment Variables ###
|
||||
|
||||
Homemaker supports the expansion of environment variables for both command and link blocks. This is a good way of
|
||||
avoiding having to hard code absolute paths into your configuration file. To reference an environment variable simply
|
||||
use `${ENVVAR}` or `$ENVVAR`, where `ENVVAR` is the variable name (notice the similarity to normal shell variable
|
||||
expansion). In addition to being able to reference all of the environment variables defined on your system, Homemaker
|
||||
defines a couple of extra ones for ease of use:
|
||||
Homemaker supports the expansion of environment variables for both command and link blocks as well as for dependencies.
|
||||
This is a good way of avoiding having to hard code absolute paths into your configuration file. To reference an
|
||||
environment variable simply use `${ENVVAR}` or `$ENVVAR`, where `ENVVAR` is the variable name (notice the similarity
|
||||
to normal shell variable expansion). In addition to being able to reference all of the environment variables defined
|
||||
on your system, Homemaker defines a couple of extra ones for ease of use:
|
||||
|
||||
* `HM_CONFIG`
|
||||
|
||||
|
2
task.go
2
task.go
@ -25,6 +25,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type task struct {
|
||||
@ -52,6 +53,7 @@ func (t *task) deps(conf *config) []string {
|
||||
|
||||
func (t *task) process(conf *config) error {
|
||||
for _, currTask := range t.deps(conf) {
|
||||
currTask = os.ExpandEnv(currTask)
|
||||
if err := processTask(currTask, conf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user