editor

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package editor provides functionality to edit YAML files while preserving comments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type YAML

type YAML struct {
	File file.File
	// contains filtered or unexported fields
}

YAML is a struct that provides methods to edit YAML files while preserving comments.

func New

func New(file file.File) *YAML

New creates a new YAML editor instance with the specified file.

func (*YAML) Load

func (y *YAML) Load() error

Load loads the YAML file along with its comments into the editor.

func (*YAML) Merge

func (y *YAML) Merge(input map[string]any) error

Merge updates the YAML file with the provided map. It reads the existing YAML file, and merges the input map into it.

func (*YAML) Save

func (y *YAML) Save() error

Save writes the current data back to the YAML file, preserving comments.

func (*YAML) Write

func (y *YAML) Write(input map[string]any) error

Write updates the YAML file with the provided map.

Jump to

Keyboard shortcuts

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