dotfile

package
v0.0.0-...-319e03c Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathExpander

type PathExpander func(string) (string, error)

PathExpander is a type of function that takes a path and returns an expanded version of that path, as well as an error indicating if something went wrong expanding the path.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is a type that is used to resolve files to maps from files to their output locations.

func NewResolver

func NewResolver(
	dotRoot string,
	outRoot string,
	dotPrefix bool,
	expand PathExpander,
) Resolver

NewResolver creates a new Resolver. dotRoot is the root of all of the files that will be resolved. outRoot is the default location of the output files. dotPrefix indicates if "dot-" prefixes should be expanded. expand is a PathExpander that is used to expand the paths as they are being resolved.

func (Resolver) DeepResolve

func (r Resolver) DeepResolve(
	files []string,
	rules map[string]string,
) (map[string]string, error)

DeepResolve resolves the placement of files by mapping every input file to an output file and using the rules to change the location of individual files mentioned or all files within a mentioned folder, the more specific the folder the higher priority to take when resolving.

func (Resolver) ShallowResolve

func (r Resolver) ShallowResolve(
	files []string,
	rules map[string]string,
) (map[string]string, error)

ShallowResolve resolves the placement of files by creating a map from only files that exist and are in the rules to their associated location in the rules. Dot expansion is always ignored. If the rule map has no key-value pairs that match any of the files, the returned map has a single key from the root of the dots to the output root. If something goes wrong during file expansion, that is reflected in a non-nil error.

Jump to

Keyboard shortcuts

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