Constants
You can define constants for data that you want to use multiple times throughout your Toolchain.
constants.cli
my-toolchain {
const my-const = "My Dear Constant Value"
action "echo $(my-const)"
}
Console
$ my-toolchain
My Dear Constant Value
Scope
Constants are visible in both the defined scope and the child scopes.
templates.cli
my-toolchain {
const my-const = "My Dear Constant Value"
sub my-child {
action "echo Child $(my-const)"
}
}
Console
$ my-toolchain my-child
Child My Dear Constant Value
Templates
You can use templates when assigning a value to a constant. Reference other constants or parameters.
templates.cli
my-toolchain {
const my = "My"
const dear = "Dear"
const constant = "Constant"
const value = "Value"
const my-const = "$(my) $(dear) $(constant) $(value)"
sub my-child {
action "echo Child $(my-const)"
}
}
Console
$ my-toolchain my-child
Child My Dear Constant Value