merge

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: 4 Imported by: 0

Documentation

Overview

Package merge provides the core configuration merging logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(handler format.Handler, managed, current any, paths []path.Path, opts Options) any

Merge combines a managed configuration with the current configuration, resolving each key by its owner:

  • declared in the script -> managed wins
  • named by an ignore path -> current wins (the app owns it)
  • present only in current -> dropped, or preserved when opts.PreserveUnknown

Types

type Options added in v0.2.0

type Options struct {
	// PreserveUnknown keeps keys that exist only in the current (live) file.
	//
	// When false, the managed config is the whole truth: a key survives only if
	// the script declares it or an ignore path names it, and anything else the
	// app wrote is dropped. That makes the ignore list load-bearing -- you must
	// predict every key the app might invent, or lose it on the next apply.
	//
	// When true, an unrecognized key is preserved instead of destroyed. The
	// trade-off is that removing a key from the script no longer removes it from
	// the file; a stale key lingers until deleted explicitly. That is a visible,
	// recoverable failure, where silently discarding a user's settings is not.
	PreserveUnknown bool
}

Options configures merge behavior.

Jump to

Keyboard shortcuts

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