Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Get-OfficeTomlNode

Module
PSWriteOffice
Inputs
OfficeIMO.Toml.TomlDocument
Outputs
System.Management.Automation.PSObject

Gets nodes of a live TOML document by path, as Path, Value, Node, Line and Column objects.

Syntax

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

Description

Select uses the engine's path grammar, the one YAML node paths use: dotted keys, [n] for 0-based array items and tables of an array of tables, and ["key.with.dots"] for keys that are not plain names. Value holds plain PowerShell data as ConvertFrom-OfficeToml returns it; Node is the live node. Line and Column are 1-based and point at the value or the [ of a header; tables made by dotted keys and nodes added by editing report 0. Without Select, the root table is returned.

Examples

Read one value.

(Get-OfficeTomlNode -Document $document -Select 'tool.ruff.line-length').Value

Find where settings live in the file.

Get-OfficeTomlNode -Document $document -Select 'project.version', 'tool.uv.sources["my.pkg"]' |
                Select-Object -Property Path, Value, Line, Column

Parameters

-AsHashtable SwitchParameter optional
Return tables in Value as ordered hashtables instead of PSCustomObjects.
-Document TomlDocument optionalpipeline: True (ByValue)
Gets or sets an explicit live document; omission uses the enclosing content block.
-Select String[] optionalposition: 0
Paths of the nodes to get; omission returns the root table.

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.