toml

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package toml provides a TOML format handler for chezmoi-split.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(content string, err error) error

FormatError returns a detailed error message for TOML parse errors.

Types

type Handler

type Handler struct{}

Handler implements format.Handler for TOML files.

func New

func New() *Handler

New creates a new TOML handler.

func (*Handler) GetPath

func (h *Handler) GetPath(tree any, p path.Path) (any, bool)

GetPath extracts a value at the given path, supporting wildcards.

func (*Handler) Parse

func (h *Handler) Parse(data []byte, opts format.ParseOptions) (any, error)

Parse reads TOML bytes and returns an *orderedmap.OrderedMap. Key order from the original TOML document is preserved.

func (*Handler) Serialize

func (h *Handler) Serialize(tree any, opts format.SerializeOptions) ([]byte, error)

Serialize writes the tree to formatted TOML bytes.

func (*Handler) SetPath

func (h *Handler) SetPath(tree any, p path.Path, value any) error

SetPath sets a value at the given path, supporting wildcards. Creates intermediate maps as needed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址