butanex

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package butanex contains a demo of how to merge multiple butane YAML files together.

At this stage its more a demo of the challenges and corner cases for building a single Butane YAML file from a collection of files and demonstrating the ambiguity in how to handle overlapping keys between two files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeFiles

func MergeFiles(options *Options, path ...string) ([]byte, error)

MergeFiles will merge each of the YAML files specified into single array of bytes of yaml intended to be passed directly to Butane transformation.

Types

type Options

type Options struct {
	FilesDir    string
	ResolvePath []string

	DefaultOverWrite bool
	Overwrite        []string
	Append           []string
}

Options configure merge behavior for a given key within a YAML mapping node (ie a struct field).

Each of the slice fields (ResolvePath, Overwrite, Append) should contain 0 or more patterns to apply this behavior to specific keys in a given YAML object. Each pattern is a string that matches a context path for example `$.storage.files.path`. A pattern can be relative or absolute. A relative pattern matches any context path with the same suffix. An absolute pattern matches the whole context key. Precedence for patterns is absolute, then relative then default.

Jump to

Keyboard shortcuts

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