Documentation ¶
Overview ¶
Package repos provides the Repo type
Index ¶
- func SortTargetNames(targets map[string]Target) []string
- type Repo
- func (repo *Repo) ApplyExcludes(excludes []string) (targets map[string]Target, err error)
- func (repo *Repo) ApplyIncludes(includes []string) (found map[string]Target, err error)
- func (repo *Repo) ApplyRenames(renames []config.Rename) map[string]Target
- func (repo *Repo) ApplyTemplates(templates []string, templateVars map[string]interface{}) (err error)
- func (repo *Repo) Check() (err error)
- func (repo *Repo) Clone() (err error)
- func (repo *Repo) FS() billy.Filesystem
- func (repo *Repo) Glob(pattern string) (matches []string, err error)
- func (repo *Repo) GlobTargets(pattern string) (matches map[string]Target, err error)
- func (repo *Repo) Init() (err error)
- func (repo *Repo) LoadConfig(search ...string) (cfg *config.Config, err error)
- func (repo *Repo) Open(name string) (io.Reader, error)
- func (repo *Repo) ReadFile(name string) ([]byte, error)
- func (repo *Repo) ResetTargets()
- func (repo *Repo) Stat(name string) (os.FileInfo, error)
- func (repo *Repo) Targets() map[string]Target
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortTargetNames ¶
SortTargetNames returns the sorted keys of a target map
Types ¶
type Repo ¶
type Repo struct { // Requested URL and git ref, these may not be the same as actual URL string Ref string // contains filtered or unexported fields }
Repo is an in-memory git repository.
func GetLocalRepo ¶
GetLocalRepo returns a local Repo reference assuming we're executing this somewhere in the context of a git repository structure.
func (*Repo) ApplyExcludes ¶
ApplyExcludes applies the given excludes to the current targets.
The returned value is the mapping of all targets.
func (*Repo) ApplyIncludes ¶
ApplyIncludes applies the given includes to the current targets.
The returned value is the mapping of all targets.
func (*Repo) ApplyRenames ¶
ApplyRenames applies the given renames.
The returned value is the mapping of the renamed file to the original file. It can be mutated manually to change the internal state of the repo renames.
func (*Repo) ApplyTemplates ¶
func (repo *Repo) ApplyTemplates(templates []string, templateVars map[string]interface{}) (err error)
ApplyTemplates creates the templates in our map of targets.
func (*Repo) GlobTargets ¶
GlobTargets returns a mapping of renamed filename to original filenames matching the given pattern.
func (*Repo) Init ¶
Init creates the memory filesystem and storage for the repository.
This will make network requests to find the default branch, as well as read the filesystem to load the gitconfig.
func (*Repo) LoadConfig ¶
LoadConfig returns the config in this Repo if it exists.
func (*Repo) ReadFile ¶
ReadFile reads the named file and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.
This implementation is stolen from os.ReadFile
func (*Repo) ResetTargets ¶
func (repo *Repo) ResetTargets()
ResetTargets initializes the renamed map to the current list of files.
type Target ¶
type Target struct { Name string // Original file name Vars map[string]interface{} // Template variables, if it is a template // contains filtered or unexported fields }
Target represents a single target file or template