Environment Variable
Specify the same environment variables cross shell.
Syntaxโ
env:
- name: ALIAE_CONFIG
value: /Users/Jan/configs/aliae.yaml
Variableโ
| Name | Type | Description |
|---|---|---|
name | string | the variable name |
value | any | the variable value, supports templating |
delimiter | string | if you want to join an array of string values (separated by newlines), supports templating |
if | string | golang template conditional statement, see if |
persist | boolean | if you want to persist the environment variable into the registry for the current user (Windows only) |
type | string | type to export to, possible values are string (default) and array |
isPath | boolean | if true, normalize rendered path separators to the current OS style |
ifExists | boolean | if true, export only when the rendered path exists as a directory (requires isPath: true) |
Path-valued environment variablesโ
Use isPath: true for environment variables that represent filesystem paths.
This keeps PATH/CDPATH behavior scoped to their own config sections while giving
other env vars explicit path normalization.
When isPath: true and value is multiline, aliae automatically behaves as if
ifExists: true and picks the first existing directory. For single-line values,
ifExists remains false unless you set it explicitly.
env:
- name: ANDROID_SDK_ROOT
value: '{{ .Home }}/AppData/Local/Android/Sdk'
isPath: true
ifExists: true
- name: ANDROID_HOME
value: |
{{ env "LOCALAPPDATA" }}/Android/Sdk
{{ .Home }}/Library/Android/sdk
{{ .Home }}/Android/Sdk
isPath: true
tip
If a single-line value starts with a Go template, quote the entire string.
Expected output by shellโ
The examples below use:
env:
- name: HELLO
value: world
- name: ARRAY
value: hello array world
type: array
- bash
- zsh
- fish
- pwsh
- nu
- tcsh
- xonsh
- cmd
export HELLO="world"
export ARRAY=("hello" "array" "world")
export HELLO="world"
export ARRAY=("hello" "array" "world")
set --global --export HELLO world
set --global --export ARRAY hello array world
$env:HELLO = "world"
$env:ARRAY = @("hello","array","world")
export-env {
$env.HELLO = "world"
$env.ARRAY = ["hello" "array" "world"]
}
setenv HELLO "world";
array output is not supported in tcsh.
$HELLO = "world"
$ARRAY = ["hello","array","world"]
os.setenv("HELLO", "world")
array output is not supported in cmd.