Option transformations🔗
Each option transformation requires the use of one of the following selectors, explicitly and unambiguously stating on which option(s) the transformation should apply.
Example:
add_assignment🔗
AddAssignment adds an assignment to an existing option.
Usage🔗
add_comments🔗
AddComments adds comments to an option.
Usage🔗
array_to_append🔗
ArrayToAppend updates the option to perform an "append" assignment.
Example:
```
func Tags(tags []string) {
this.resource.tags = tags
}
```
Will become:
```
func Tags(tags string) {
this.resource.tags.append(tags)
}
```
This action returns the option unchanged if: - it doesn't have exactly one argument - the argument is not an array
Usage🔗
debug🔗
Debug prints debugging information about an option.
Usage🔗
disjunction_as_options🔗
DisjunctionAsOptions uses the branches of the first argument's disjunction (assuming it is one) and turns them into options.
Example:
```
func Panel(panel Panel|Row) {
this.resource.panels.append(panel)
}
```
Will become:
```
func Panel(panel Panel) {
this.resource.panels.append(panel)
}
func Row(row Row) {
this.resource.panels.append(row)
}
```
This action returns the option unchanged if: - it has no arguments - the given argument is not a disjunction or a reference to one
Usage🔗
duplicate🔗
N/A
Usage🔗
map_to_index🔗
MapToIndex updates the option to perform an "index" assignment.
Example:
```
func Elements(elements map[string]Element) {
this.resource.elements = elements
}
```
Will become:
```
func Elements(key string, elements Element) {
this.resource.elements[key] = tags
}
```
This action returns the option unchanged if: - it doesn't have exactly one argument - the argument is not a map
Usage🔗
omit🔗
Omit removes an option.
Usage🔗
rename🔗
Rename renames an option.
Usage🔗
rename_arguments🔗
RenameArguments renames the arguments of an options.
Usage🔗
struct_fields_as_arguments🔗
StructFieldsAsArguments uses the fields of the first argument's struct (assuming it is one) and turns them into arguments.
Optionally, an explicit list of fields to turn into arguments can be given.
Example:
```
func Time(time {from string, to string) {
this.resource.time = time
}
```
Will become:
```
func Time(from string, to string) {
this.resource.time.from = from
this.resource.time.to = to
}
```
This action returns the option unchanged if: - it has no arguments - the first argument is not a struct or a reference to one
FIXME: considers the first argument only.
Usage🔗
struct_fields_as_options🔗
StructFieldsAsOptions uses the fields of the first argument's struct (assuming it is one) and turns them into options.
Optionally, an explicit list of fields to turn into options can be given.
Example:
```
func GridPos(gridPos {x int, y int) {
this.resource.gridPos = gridPos
}
```
Will become:
```
func X(x int) {
this.resource.gridPos.x = x
}
func Y(y int) {
this.resource.gridPos.y = y
}
```
This action returns the option unchanged if: - it has no arguments - the first argument is not a struct or a reference to one
FIXME: considers the first argument only.
Usage🔗
unfold_boolean🔗
UnfoldBoolean transforms an option accepting a boolean argument into two argument-less options.
Example:
```
func Editable(editable bool) {
this.resource.editable = editable
}
```
Will become:
```
func Editable() {
this.resource.editable = true
}
func ReadOnly() {
this.resource.editable = false
}
```