Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Remove-OfficeTomlNode

Module
PSWriteOffice
Inputs
OfficeIMO.Toml.TomlDocument

Removes keys, tables or array items from a live TOML document by path.

Syntax

Remove-OfficeTomlNode
[-Document <TomlDocument>]
[-Select] <String[]>
[<CommonParameters>]
#
Parameter set: Document

Description

A key goes with its line and the comment lines directly above it; a table goes with all of its sections, wherever they are in the file. Neighboring keys and comments stay. A path with nothing at it writes a non-terminating ObjectNotFound error.

Examples

Drop a setting inside an editing block.

Open-OfficeToml -Path ./pyproject.toml {
    Remove-OfficeTomlNode -Select 'tool.ruff.lint.ignore'
}

Remove a table of an array of tables if it is there.

Remove-OfficeTomlNode -Document $document -Select 'bin[1]' -ErrorAction SilentlyContinue

Parameters

-Document TomlDocument optionalpipeline: True (ByValue)
Gets or sets an explicit live document; omission uses the enclosing content block.
-Select String[] requiredposition: 0
Paths of the keys, tables or items to remove.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.