|
1 |
| ---- |
2 |
| -id: templates |
3 |
| -title: Templates |
4 |
| -sidebar_label: 🏛️ Templates |
5 |
| ---- |
6 |
| - |
7 |
| -## Example |
8 |
| - |
9 |
| -```yaml |
10 |
| -env: |
11 |
| - - name: POSH_THEME |
12 |
| - value: {{ .Home }}/.configs/posh.omp.yaml |
13 |
| -``` |
14 |
| -
|
15 |
| -## Description |
16 |
| -
|
17 |
| -Some fields have [text/template][go-text-template] abilities, allowing to reuse the same |
18 |
| -configuration across multiple environments resulting in environment specific values. |
19 |
| -
|
20 |
| -Out of the box you get the following functionality: |
21 |
| -
|
22 |
| -| Name | Type | Description | Example | |
23 |
| -| ------------ | --------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- | |
24 |
| -| `.Shell` | `string` | the current shell name | `{{ .Shell }}` | |
25 |
| -| `.Home` | `string` | the user's `$HOME` folder | `{{ .Home }}/go/bin/aliae` | |
26 |
| -| `.OS` | `string` | the current operating system (`windows`, `darwin`, `linux`) | `{{ .Home }}/go/bin/aliae{{ if eq .OS "windows" }}.exe{{ end }}` | |
27 |
| -| `.Arch` | `string` | the `aliae` executable's compiled architecture | `{{ .Home }}/go/bin/aliae-{{ .Arch }}{{ if eq .OS "windows" }}.exe{{ end }}` | |
28 |
| -| `env` | `string` | retrieve an environment variable value | `{{ env "POSH_THEME" }}` | |
29 |
| -| `match` | `boolean` | match a shell name to one or multiple options | `{{ match .Shell "zsh" "bash" }}` | |
30 |
| -| `hasCommand` | `boolean` | check if an executable exists | `{{ hasCommand "oh-my-posh" }}` | |
31 |
| - |
32 |
| -[go-text-template]: https://golang.org/pkg/text/template/ |
| 1 | +--- |
| 2 | +id: templates |
| 3 | +title: Templates |
| 4 | +sidebar_label: 🏛️ Templates |
| 5 | +--- |
| 6 | + |
| 7 | +## Example |
| 8 | + |
| 9 | +```yaml |
| 10 | +env: |
| 11 | + - name: POSH_THEME |
| 12 | + value: '{{ .Home }}/.configs/posh.omp.yaml' |
| 13 | +``` |
| 14 | +
|
| 15 | +## Description |
| 16 | +
|
| 17 | +Some fields have [text/template][go-text-template] abilities, allowing to reuse the same |
| 18 | +configuration across multiple environments resulting in environment specific values. |
| 19 | +
|
| 20 | +Out of the box you get the following functionality: |
| 21 | +
|
| 22 | +| Name | Type | Description | Example | |
| 23 | +| ------------ | --------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- | |
| 24 | +| `.Shell` | `string` | the current shell name | `{{ .Shell }}` | |
| 25 | +| `.Home` | `string` | the user's `$HOME` folder | `{{ .Home }}/go/bin/aliae` | |
| 26 | +| `.OS` | `string` | the current operating system (`windows`, `darwin`, `linux`) | `{{ .Home }}/go/bin/aliae{{ if eq .OS "windows" }}.exe{{ end }}` | |
| 27 | +| `.Arch` | `string` | the `aliae` executable's compiled architecture | `{{ .Home }}/go/bin/aliae-{{ .Arch }}{{ if eq .OS "windows" }}.exe{{ end }}` | |
| 28 | +| `env` | `string` | retrieve an environment variable value | `{{ env "POSH_THEME" }}` | |
| 29 | +| `match` | `boolean` | match a shell name to one or multiple options | `{{ match .Shell "zsh" "bash" }}` | |
| 30 | +| `hasCommand` | `boolean` | check if an executable exists | `{{ hasCommand "oh-my-posh" }}` | |
| 31 | + |
| 32 | +:::tip |
| 33 | +When using a template in a single line, you have to use quotes to wrap the template string. |
| 34 | + |
| 35 | +```yaml |
| 36 | +env: |
| 37 | + - name: POSH_THEME |
| 38 | + value: '{{ .Home }}/.configs/posh.omp.yaml' |
| 39 | +``` |
| 40 | +::: |
| 41 | + |
| 42 | +[go-text-template]: https://golang.org/pkg/text/template/ |
0 commit comments