Merge TOML table row

Apache 2.0

Merge a TOML row into an array table. If a row with the same identifying property exists, merge the values. Otherwise, insert a new row.

org.openrewrite.toml.MergeTableRow

Required

The name of the TOML array table to merge into (e.g., 'package.contributors').

The TOML key-value pairs to merge. Should contain the objectIdentifyingProperty.

The property name used to match existing rows. When a row with this property value exists, it will be merged; otherwise, a new row is inserted. When the original row has more properties than the incoming row, these original properties are preserved. Entries with null values in the incoming row will result in the removal of the property from the original row.

mod run . --recipe=org.openrewrite.toml.MergeTableRow \ -P tableName=package.contributors \ -P row='name = "Alice Smith"\nemail = "alice@example.com"' \ -P identifyingKey=name

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.