-
Notifications
You must be signed in to change notification settings - Fork 3
Variables Module
The variables modules allows you to setup common values needed throughout a palette, to save you time in updating lots of places later on.
Once you specify a variable, it can be used later on - in anything - by just referencing "#(<variable-name>)"
. And by anything, I mean anything - although the variable reference is passed in via a string, you can pass it regardless of a property's type.
Key | Type | Description | Values |
---|---|---|---|
variables | key-value pair list | This is a list of key-value pairs, where the key is the variable name and the value is the variables value. The value can be of any type | - |
The following is an example of using the variables type in a paint section:
{
"paint": [
{
"type": "variables",
"variables": {
"value1": "install",
"value2": 123,
"value3": true
}
},
{
"type": "echo",
"text": "Easy as #(value2)"
},
{
"type": "windows-optional-feature",
"ensure": "install",
"all": "#(value3)",
"names": [
"Microsoft-Hyper-V"
]
}
]
}
The above will setup three variables called value1
, value2
and value3
, each with the values install
, 123
and true
respectively.
The echo command will output Easy as 123
.
The windows optional features command has a property all
which actually takes a boolean value. Regardless you can still pass a variable like above, and just like the value assigned to 'value3', 'all' will be true.
The erase section is identical to the paint section.