String Expansion

String-expansion, also called string interpolation in programming languages, refers to nittos ability to expand parts of a string into dynamic content. This however is only triggered when the command the string is an argument for, explictly requests this, so check the commands documentation to be sure.

The syntax of expansion is very simple: "$(my.data.key)". When this string is expanded, the parent datastore is called, and the key my.data.key is requested. The returning data is stringified (if possible) and then used as replacement for the invocoation.

It also works like your typically string interpolation: all characters to the left and right will be also present in the result: Let’s say we have an datastore that maps user.name to the string Bob. When we now expand "Good morning, $(user.name)!", the resulting string will be "Good morning, Bob!".

Additionally, when expanding, you can request filters to be applied to the value from the datastore, which allows to transform the value before it is used to embedd it into the final string. Because of this we refer to the content of an expansion also as a ‘pipeline’. Filters are added after the initial key and are seperated by an pipe character: |.

So for example: $(some.version | grep '^[0-9]+\.[0-9]+') with a value of 11.24.7 for some.version will result in the value being regex-matched and transformed into 11.24. With this you easily can transform the data from the store into anything you might need to configure & build a target.

For a list of core filters, see here.