variable_iterator_from_file
Define a variable that will be automatically iterated over.
⚙️ Compatible targets: Linux
Parameters
Name | Documentation |
---|---|
prefix | The prefix of the variable name. This parameter is required. |
name | The variable to define, the full name will be prefix.name. This parameter is required. |
file_name | The path to the file. This parameter is required. |
separator_regex | Regular expression that is used to split the value into items ( usually: \n ). This parameter is required. |
comments_regex | Regular expression that is used to remove comments ( usually: \s*#.*?(?=\n) ). This parameter is required. |
Outcome conditions
You need to replace ${name}
with its actual canonified value.
- ✅ Ok:
variable_iterator_from_file_${name}_ok
- ☑️ Already compliant:
variable_iterator_from_file_${name}_kept
- 🟨 Repaired:
variable_iterator_from_file_${name}_repaired
- ☑️ Already compliant:
- ❌ Error:
variable_iterator_from_file_${name}_error
Example
method: variable_iterator_from_file
params:
prefix: VALUE
file_name: VALUE
separator_regex: VALUE
name: VALUE
comments_regex: VALUE
Documentation
The generated variable is a special variable that is automatically iterated over. When you call a generic method with this variable as a parameter, n calls will be made, one for each items of the variable. Note: there is a limit of 10000 items Note: empty items are ignored
To use the generated variable, you must use the form ${prefix.name}
with each name replaced with the parameters of this method.
Be careful that using a global variable can lead to unpredictable content in case of multiple definition, which is implicitly the case when a technique has more than one instance (directive). Please note that only global variables are available within templates.