1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 13:29:16 +00:00

adding profile specific (dyn)variables for #81

This commit is contained in:
deadc0de6
2019-01-17 19:07:28 +01:00
parent 91b1b7f7fe
commit 7ba8ed32b8
4 changed files with 188 additions and 7 deletions

View File

@@ -588,6 +588,8 @@ the following entries:
need to be managed
* `dotfiles`: the dotfiles associated to this profile
* `include`: include all dotfiles from another profile (optional)
* `variables`: profile specific variables (see [Variables](#variables))
* `dynvariables`: profile specific interpreted variables (see [Interpreted variables](#interpreted-variables))
```yaml
<some-name-usually-the-hostname>:
@@ -599,6 +601,10 @@ the following entries:
include:
- <some-other-profile>
- ...
variables:
<name>: <value>
dynvariables:
<name>: <value>
```
* **actions** entry (optional): a list of action (see [Use actions](#use-actions))
@@ -715,6 +721,7 @@ For example in the config file:
```yaml
variables:
var1: some variable content
var2: some other content
```
These can then be used in any template with
@@ -722,6 +729,26 @@ These can then be used in any template with
{{@@ var1 @@}}
```
Profile variables will take precedence over globally defined variables what
means that you could do something like this:
```
variables:
git_email: home@email.com
dotfiles:
f_gitconfig:
dst: ~/.gitconfig
src: gitconfig
profiles:
work:
dotfiles:
- f_gitconfig
variables:
git_email: work@email.com
private:
dotfiles:
- f_gitconfig
```
## Interpreted variables
It is also possible to have *dynamic* variables in the sense that their
@@ -740,6 +767,9 @@ These can be used as any variables in the templates
{{@@ dvar1 @@}}
```
As for variables (see [Variables](#variables)) profile dynvariables will take
precedence over globally defined dynvariables.
## Environment variables
It's possible to access environment variables inside the templates.