copier

package
v0.0.0-...-bb263ce Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Date  time.Time `yaml:"date,omitempty"`
	Name  string    `yaml:"name,omitempty"`
	Email string    `yaml:"email,omitempty"`
}

type Copier

type Copier interface {
	// Returns weather the copier is for a specific url or not
	Matches(url string) bool
	// This function downloads and saves all files that should later be
	// pasted to the "to" directory into the "TempDir" directory.
	//
	// Copy must retrun a serializable object that is later saved inside "pasta.result.yaml".
	// Look at SourceInfo for an example.
	Copy(ctx context.Context, config CopyConfig) (any, error)
}

type CopyConfig

type CopyConfig struct {
	// URL of the dependency
	URL string
	// Directory from which copy takes place from
	From string
	// returns true if file with path relative to Src should be copied
	Keep func(path string) bool
	// Custom copier options from the pasta.yaml
	Options map[string]string
	// TempDir contains the path to write all files.
	TempDir string
	// ClearTarget is true if the target directory should be cleared before copying
	ClearTarget bool
}

type SourceInfo

type SourceInfo struct {
	Reference string `yaml:"reference,omitempty"`
	Message   string `yaml:"message,omitempty"`
	Author    Author `yaml:"author,omitempty"`
}

SourceInfo is serialized into the `pasta.result.yaml` in the end

Jump to

Keyboard shortcuts

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