replacer

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Replacer

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

func New

func New(
	git *git.Repository,
	root string,
	filesCmd string,
) Replacer

func NewMocked

func NewMocked(files []string) Replacer

func (Replacer) AddGitArgs added in v2.1.2

func (r Replacer) AddGitArgs(args []string) Replacer

func (Replacer) AddTemplates added in v2.1.2

func (r Replacer) AddTemplates(templates map[string]string) Replacer

func (Replacer) Cached added in v2.0.10

func (r Replacer) Cached(key string) bool

func (Replacer) Discover

func (r Replacer) Discover(source string, filter *filter.Filter) error

Discover finds patterns in `source` and caches the results.

func (Replacer) Empty

func (r Replacer) Empty(key string) bool

func (Replacer) Files

func (r Replacer) Files(template string, filter *filter.Filter) ([]string, error)

func (Replacer) HasEmpty added in v2.0.14

func (r Replacer) HasEmpty() bool

func (Replacer) ReplaceAndSplit

func (r Replacer) ReplaceAndSplit(command string, maxlen int) ([]string, []string)

ReplaceAndSplit substitutes file templates in command and chunks the result to respect maxlen. It consumes the cache entries (entry.items is drained), so this method should be called only once per Replacer instance.

Jump to

Keyboard shortcuts

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