Skip to content

Support + in key names #644

@BrianHarris

Description

@BrianHarris

I'm working on a system that allows for merging TOML files together. For example you could have a "Base" config and a platform specific "Override" config.

For scalars it's easy -- overwrite the old value. For arrays it's tricky though because we want the ability to add and remove elements.

I'd like the ability to prefix a key or table name with + to indicate it should be added to an existing array, or - to indicate it should be removed. For example:

[table]
+key=[ "These elements", " are added to an existing key" ]
-key=[ "These elements", " are removed from an existing key" ]

I can do it right now by enclosing the name in quotes, but it would be really nice to specify them with bare keys.

Alternatively, TOML could support explicit merging with += and -= operators, but that seems like a much bigger change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions