Documentation ¶
Index ¶
- Constants
- Variables
- func Debugf(format string, args []interface{}, f func() error) error
- func GetUmask() os.FileMode
- func IsPrivate(fs vfs.Stater, path string, want bool) (bool, error)
- func MaybeShellQuote(s string) string
- func SetUmask(newUmask os.FileMode)
- func ShellQuoteArgs(args []string) string
- type AddOptions
- type AnyMutator
- func (m *AnyMutator) Chmod(name string, mode os.FileMode) error
- func (m *AnyMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (m *AnyMutator) Mkdir(name string, perm os.FileMode) error
- func (m *AnyMutator) Mutated() bool
- func (m *AnyMutator) RemoveAll(name string) error
- func (m *AnyMutator) Rename(oldpath, newpath string) error
- func (m *AnyMutator) RunCmd(cmd *exec.Cmd) error
- func (m *AnyMutator) Stat(path string) (os.FileInfo, error)
- func (m *AnyMutator) WriteFile(name string, data []byte, perm os.FileMode, currData []byte) error
- func (m *AnyMutator) WriteSymlink(oldname, newname string) error
- type ApplyOptions
- type BoltPersistentState
- type DebugMutator
- func (m *DebugMutator) Chmod(name string, mode os.FileMode) error
- func (m *DebugMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (m *DebugMutator) Mkdir(name string, perm os.FileMode) error
- func (m *DebugMutator) RemoveAll(name string) error
- func (m *DebugMutator) Rename(oldpath, newpath string) error
- func (m *DebugMutator) RunCmd(cmd *exec.Cmd) error
- func (m *DebugMutator) Stat(name string) (os.FileInfo, error)
- func (m *DebugMutator) WriteFile(name string, data []byte, perm os.FileMode, currData []byte) error
- func (m *DebugMutator) WriteSymlink(oldname, newname string) error
- type Dir
- func (d *Dir) AppendAllEntries(allEntries []Entry) []Entry
- func (d *Dir) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
- func (d *Dir) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
- func (d *Dir) Evaluate(ignore func(string) bool) error
- func (d *Dir) Private() bool
- func (d *Dir) SourceName() string
- func (d *Dir) TargetName() string
- type DirAttributes
- type Entry
- type FSMutator
- type File
- func (f *File) AppendAllEntries(allEntries []Entry) []Entry
- func (f *File) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
- func (f *File) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
- func (f *File) Contents() ([]byte, error)
- func (f *File) Evaluate(ignore func(string) bool) error
- func (f *File) Executable() bool
- func (f *File) Private() bool
- func (f *File) SourceName() string
- func (f *File) TargetName() string
- type FileAttributes
- type GPG
- type GitDiffMutator
- func (m *GitDiffMutator) Chmod(name string, mode os.FileMode) error
- func (m *GitDiffMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (m *GitDiffMutator) Mkdir(name string, perm os.FileMode) error
- func (m *GitDiffMutator) RemoveAll(name string) error
- func (m *GitDiffMutator) Rename(oldpath, newpath string) error
- func (m *GitDiffMutator) RunCmd(cmd *exec.Cmd) error
- func (m *GitDiffMutator) Stat(name string) (os.FileInfo, error)
- func (m *GitDiffMutator) WriteFile(filename string, data []byte, perm os.FileMode, currData []byte) error
- func (m *GitDiffMutator) WriteSymlink(oldname, newname string) error
- type ImportTAROptions
- type Mutator
- type NullMutator
- func (NullMutator) Chmod(string, os.FileMode) error
- func (NullMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (NullMutator) Mkdir(string, os.FileMode) error
- func (NullMutator) RemoveAll(string) error
- func (NullMutator) Rename(string, string) error
- func (NullMutator) RunCmd(cmd *exec.Cmd) error
- func (NullMutator) Stat(path string) (os.FileInfo, error)
- func (NullMutator) WriteFile(string, []byte, os.FileMode, []byte) error
- func (NullMutator) WriteSymlink(string, string) error
- type PatternSet
- type PersistentState
- type PopulateOptions
- type Script
- func (s *Script) AppendAllEntries(allEntries []Entry) []Entry
- func (s *Script) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
- func (s *Script) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
- func (s *Script) Contents() ([]byte, error)
- func (s *Script) Evaluate(ignore func(string) bool) error
- func (s *Script) SourceName() string
- func (s *Script) TargetName() string
- type ScriptAttributes
- type ScriptState
- type Symlink
- func (s *Symlink) AppendAllEntries(allEntries []Entry) []Entry
- func (s *Symlink) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
- func (s *Symlink) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
- func (s *Symlink) Evaluate(ignore func(string) bool) error
- func (s *Symlink) Linkname() (string, error)
- func (s *Symlink) SourceName() string
- func (s *Symlink) TargetName() string
- type TargetState
- func (ts *TargetState) Add(fs vfs.FS, addOptions AddOptions, targetPath string, info os.FileInfo, ...) error
- func (ts *TargetState) AllEntries() []Entry
- func (ts *TargetState) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
- func (ts *TargetState) Archive(w *tar.Writer, umask os.FileMode) error
- func (ts *TargetState) ConcreteValue(recursive bool) (interface{}, error)
- func (ts *TargetState) Evaluate() error
- func (ts *TargetState) ExecuteTemplateData(name string, data []byte) ([]byte, error)
- func (ts *TargetState) Get(fs vfs.Stater, target string) (Entry, error)
- func (ts *TargetState) ImportTAR(r *tar.Reader, importTAROptions ImportTAROptions, mutator Mutator) error
- func (ts *TargetState) Populate(fs vfs.FS, options *PopulateOptions) error
- type TargetStateOption
- func WithDestDir(destDir string) TargetStateOption
- func WithEntries(entries map[string]Entry) TargetStateOption
- func WithGPG(gpg *GPG) TargetStateOption
- func WithMinVersion(minVersion *semver.Version) TargetStateOption
- func WithSourceDir(sourceDir string) TargetStateOption
- func WithTargetIgnore(targetIgnore *PatternSet) TargetStateOption
- func WithTargetRemove(targetRemove *PatternSet) TargetStateOption
- func WithTemplateData(templateData map[string]interface{}) TargetStateOption
- func WithTemplateFuncs(templateFuncs template.FuncMap) TargetStateOption
- func WithTemplateOptions(templateOptions []string) TargetStateOption
- func WithTemplates(templates map[string]*template.Template) TargetStateOption
- func WithUmask(umask os.FileMode) TargetStateOption
- type VerboseMutator
- func (m *VerboseMutator) Chmod(name string, mode os.FileMode) error
- func (m *VerboseMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (m *VerboseMutator) Mkdir(name string, perm os.FileMode) error
- func (m *VerboseMutator) RemoveAll(name string) error
- func (m *VerboseMutator) Rename(oldpath, newpath string) error
- func (m *VerboseMutator) RunCmd(cmd *exec.Cmd) error
- func (m *VerboseMutator) Stat(name string) (os.FileInfo, error)
- func (m *VerboseMutator) WriteFile(name string, data []byte, perm os.FileMode, currData []byte) error
- func (m *VerboseMutator) WriteSymlink(oldname, newname string) error
Constants ¶
const (
TemplateSuffix = ".tmpl"
)
Suffixes and prefixes.
Variables ¶
var DefaultTemplateOptions = []string{"missingkey=error"}
DefaultTemplateOptions are the default template options.
Functions ¶
func MaybeShellQuote ¶
MaybeShellQuote returns s quoted as a shell argument, if necessary.
func ShellQuoteArgs ¶
ShellQuoteArgs returs args shell quoted and joined into a single string.
Types ¶
type AddOptions ¶
type AddOptions struct { Empty bool Encrypt bool Exact bool Recursive bool Template bool AutoTemplate bool }
An AddOptions contains options for TargetState.Add.
type AnyMutator ¶
type AnyMutator struct {
// contains filtered or unexported fields
}
An AnyMutator wraps another Mutator and records if any of its mutating methods are called.
func NewAnyMutator ¶
func NewAnyMutator(m Mutator) *AnyMutator
NewAnyMutator returns a new AnyMutator.
func (*AnyMutator) Chmod ¶
func (m *AnyMutator) Chmod(name string, mode os.FileMode) error
Chmod implements Mutator.Chmod.
func (*AnyMutator) IdempotentCmdOutput ¶
func (m *AnyMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (*AnyMutator) Mkdir ¶
func (m *AnyMutator) Mkdir(name string, perm os.FileMode) error
Mkdir implements Mutator.Mkdir.
func (*AnyMutator) Mutated ¶
func (m *AnyMutator) Mutated() bool
Mutated returns true if any of its methods have been called.
func (*AnyMutator) RemoveAll ¶
func (m *AnyMutator) RemoveAll(name string) error
RemoveAll implements Mutator.RemoveAll.
func (*AnyMutator) Rename ¶
func (m *AnyMutator) Rename(oldpath, newpath string) error
Rename implements Mutator.Rename.
func (*AnyMutator) RunCmd ¶
func (m *AnyMutator) RunCmd(cmd *exec.Cmd) error
RunCmd implements Mutator.RunCmd.
func (*AnyMutator) Stat ¶
func (m *AnyMutator) Stat(path string) (os.FileInfo, error)
Stat implements Mutator.Stat.
func (*AnyMutator) WriteSymlink ¶
func (m *AnyMutator) WriteSymlink(oldname, newname string) error
WriteSymlink implements Mutator.WriteSymlink.
type ApplyOptions ¶
type ApplyOptions struct { DestDir string DryRun bool Ignore func(string) bool PersistentState PersistentState Remove bool ScriptStateBucket []byte Stdout io.Writer Umask os.FileMode Verbose bool }
An ApplyOptions is a big ball of mud for things that affect Entry.Apply.
type BoltPersistentState ¶
type BoltPersistentState struct {
// contains filtered or unexported fields
}
A BoltPersistentState is a state persisted with bolt.
func NewBoltPersistentState ¶
func NewBoltPersistentState(fs vfs.FS, path string, options *bolt.Options) (*BoltPersistentState, error)
NewBoltPersistentState returns a new BoltPersistentState.
func (*BoltPersistentState) Delete ¶
func (b *BoltPersistentState) Delete(bucket, key []byte) error
Delete deletes the value associate with key in bucket. If bucket or key does not exist then Delete does nothing.
func (*BoltPersistentState) Get ¶
func (b *BoltPersistentState) Get(bucket, key []byte) ([]byte, error)
Get returns the value associated with key in bucket.
func (*BoltPersistentState) Set ¶
func (b *BoltPersistentState) Set(bucket, key, value []byte) error
Set sets the value associated with key in bucket. bucket will be created if it does not already exist.
type DebugMutator ¶
type DebugMutator struct {
// contains filtered or unexported fields
}
A DebugMutator wraps a Mutator and logs all of the actions it executes.
func NewDebugMutator ¶
func NewDebugMutator(m Mutator) *DebugMutator
NewDebugMutator returns a new DebugMutator.
func (*DebugMutator) Chmod ¶
func (m *DebugMutator) Chmod(name string, mode os.FileMode) error
Chmod implements Mutator.Chmod.
func (*DebugMutator) IdempotentCmdOutput ¶
func (m *DebugMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (*DebugMutator) Mkdir ¶
func (m *DebugMutator) Mkdir(name string, perm os.FileMode) error
Mkdir implements Mutator.Mkdir.
func (*DebugMutator) RemoveAll ¶
func (m *DebugMutator) RemoveAll(name string) error
RemoveAll implements Mutator.RemoveAll.
func (*DebugMutator) Rename ¶
func (m *DebugMutator) Rename(oldpath, newpath string) error
Rename implements Mutator.Rename.
func (*DebugMutator) RunCmd ¶
func (m *DebugMutator) RunCmd(cmd *exec.Cmd) error
RunCmd implements Mutator.RunCmd.
func (*DebugMutator) Stat ¶
func (m *DebugMutator) Stat(name string) (os.FileInfo, error)
Stat implements Mutator.Stat.
func (*DebugMutator) WriteSymlink ¶
func (m *DebugMutator) WriteSymlink(oldname, newname string) error
WriteSymlink implements Mutator.WriteSymlink.
type Dir ¶
type Dir struct { Exact bool Perm os.FileMode Entries map[string]Entry // contains filtered or unexported fields }
A Dir represents the target state of a directory.
func (*Dir) AppendAllEntries ¶ added in v1.8.0
AppendAllEntries appends all Entries in d to allEntries.
func (*Dir) ConcreteValue ¶
func (d *Dir) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
ConcreteValue implements Entry.ConcreteValue.
type DirAttributes ¶
DirAttributes holds attributes parsed from a source directory name.
func ParseDirAttributes ¶
func ParseDirAttributes(sourceName string) DirAttributes
ParseDirAttributes parses a single directory name.
func (DirAttributes) SourceName ¶
func (da DirAttributes) SourceName() string
SourceName returns da's source name.
type Entry ¶
type Entry interface { AppendAllEntries(allEntries []Entry) []Entry Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error) Evaluate(ignore func(string) bool) error SourceName() string TargetName() string // contains filtered or unexported methods }
An Entry is either a Dir, a File, or a Symlink.
type FSMutator ¶
An FSMutator makes changes to a vfs.FS.
func NewFSMutator ¶
NewFSMutator returns an mutator that acts on fs.
func (*FSMutator) IdempotentCmdOutput ¶
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (*FSMutator) WriteSymlink ¶
WriteSymlink implements Mutator.WriteSymlink.
type File ¶
type File struct { Empty bool Encrypted bool Perm os.FileMode Template bool // contains filtered or unexported fields }
A File represents the target state of a file.
func (*File) AppendAllEntries ¶ added in v1.8.0
AppendAllEntries appends all f to allEntries.
func (*File) ConcreteValue ¶
func (f *File) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
ConcreteValue implements Entry.ConcreteValue.
func (*File) Executable ¶
Executable returns true is f is executable.
func (*File) SourceName ¶
SourceName implements Entry.SourceName.
func (*File) TargetName ¶
TargetName implements Entry.TargetName.
type FileAttributes ¶
A FileAttributes holds attributes parsed from a source file name.
func ParseFileAttributes ¶
func ParseFileAttributes(sourceName string) FileAttributes
ParseFileAttributes parses a source file name.
func (FileAttributes) SourceName ¶
func (fa FileAttributes) SourceName() string
SourceName returns fa's source name.
type GPG ¶
GPG interfaces with gpg.
type GitDiffMutator ¶ added in v1.8.0
type GitDiffMutator struct {
// contains filtered or unexported fields
}
A GitDiffMutator wraps a Mutator and logs all of the actions it would execute as a git diff.
func NewGitDiffMutator ¶ added in v1.8.0
func NewGitDiffMutator(unifiedEncoder *diff.UnifiedEncoder, m Mutator, prefix string) *GitDiffMutator
NewGitDiffMutator returns a new GitDiffMutator.
func (*GitDiffMutator) Chmod ¶ added in v1.8.0
func (m *GitDiffMutator) Chmod(name string, mode os.FileMode) error
Chmod implements Mutator.Chmod.
func (*GitDiffMutator) IdempotentCmdOutput ¶ added in v1.8.0
func (m *GitDiffMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (*GitDiffMutator) Mkdir ¶ added in v1.8.0
func (m *GitDiffMutator) Mkdir(name string, perm os.FileMode) error
Mkdir implements Mutator.Mkdir.
func (*GitDiffMutator) RemoveAll ¶ added in v1.8.0
func (m *GitDiffMutator) RemoveAll(name string) error
RemoveAll implements Mutator.RemoveAll.
func (*GitDiffMutator) Rename ¶ added in v1.8.0
func (m *GitDiffMutator) Rename(oldpath, newpath string) error
Rename implements Mutator.Rename.
func (*GitDiffMutator) RunCmd ¶ added in v1.8.0
func (m *GitDiffMutator) RunCmd(cmd *exec.Cmd) error
RunCmd implements Mutator.RunCmd.
func (*GitDiffMutator) Stat ¶ added in v1.8.0
func (m *GitDiffMutator) Stat(name string) (os.FileInfo, error)
Stat implements Mutator.Stat.
func (*GitDiffMutator) WriteFile ¶ added in v1.8.0
func (m *GitDiffMutator) WriteFile(filename string, data []byte, perm os.FileMode, currData []byte) error
WriteFile implements Mutator.WriteFile.
func (*GitDiffMutator) WriteSymlink ¶ added in v1.8.0
func (m *GitDiffMutator) WriteSymlink(oldname, newname string) error
WriteSymlink implements Mutator.WriteSymlink.
type ImportTAROptions ¶
An ImportTAROptions contains options for TargetState.ImportTAR.
type Mutator ¶
type Mutator interface { Chmod(name string, mode os.FileMode) error IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error) Mkdir(name string, perm os.FileMode) error RemoveAll(name string) error Rename(oldpath, newpath string) error RunCmd(cmd *exec.Cmd) error Stat(name string) (os.FileInfo, error) WriteFile(filename string, data []byte, perm os.FileMode, currData []byte) error WriteSymlink(oldname, newname string) error }
A Mutator makes changes.
type NullMutator ¶
type NullMutator struct{}
NullMutator is an Mutator that does nothing.
func (NullMutator) Chmod ¶
func (NullMutator) Chmod(string, os.FileMode) error
Chmod implements Mutator.Chmod.
func (NullMutator) IdempotentCmdOutput ¶
func (NullMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (NullMutator) Mkdir ¶
func (NullMutator) Mkdir(string, os.FileMode) error
Mkdir implements Mutator.Mkdir.
func (NullMutator) RemoveAll ¶
func (NullMutator) RemoveAll(string) error
RemoveAll implements Mutator.RemoveAll.
func (NullMutator) Rename ¶
func (NullMutator) Rename(string, string) error
Rename implements Mutator.Rename.
func (NullMutator) RunCmd ¶
func (NullMutator) RunCmd(cmd *exec.Cmd) error
RunCmd implements Mutator.RunCmd.
func (NullMutator) Stat ¶
func (NullMutator) Stat(path string) (os.FileInfo, error)
Stat implements Mutator.Stat.
func (NullMutator) WriteSymlink ¶
func (NullMutator) WriteSymlink(string, string) error
WriteSymlink implements Mutator.WriteSymlink.
type PatternSet ¶
type PatternSet struct {
// contains filtered or unexported fields
}
An PatternSet is a set of patterns.
func (*PatternSet) Add ¶
func (ps *PatternSet) Add(pattern string, include bool) error
Add adds a pattern to ps.
func (*PatternSet) Match ¶
func (ps *PatternSet) Match(name string) bool
Match returns if name matches any pattern in ps.
type PersistentState ¶
type PersistentState interface { Close() error Delete(bucket, key []byte) error Get(bucket, key []byte) ([]byte, error) Set(bucket, key, value []byte) error }
A PersistentState is an interface to a persistent state.
type PopulateOptions ¶
type PopulateOptions struct {
ExecuteTemplates bool
}
A PopulateOptions contains options for TargetState.Populate.
type Script ¶
A Script represents a script to run.
func (*Script) AppendAllEntries ¶ added in v1.8.0
AppendAllEntries returns allEntries unchanged.
func (*Script) ConcreteValue ¶
func (s *Script) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
ConcreteValue implements Entry.ConcreteValue.
func (*Script) SourceName ¶
SourceName implements Entry.SourceName.
func (*Script) TargetName ¶
TargetName implements Entry.TargetName.
type ScriptAttributes ¶
A ScriptAttributes holds attributes parsed from a source script name.
func ParseScriptAttributes ¶
func ParseScriptAttributes(sourceName string) ScriptAttributes
ParseScriptAttributes parses a source script file name.
func (ScriptAttributes) SourceName ¶
func (sa ScriptAttributes) SourceName() string
SourceName returns sa's source name.
type ScriptState ¶
A ScriptState represents the state of a script.
type Symlink ¶
type Symlink struct { Template bool // contains filtered or unexported fields }
A Symlink represents the target state of a symlink.
func (*Symlink) AppendAllEntries ¶ added in v1.8.0
AppendAllEntries appends all f to allEntries.
func (*Symlink) ConcreteValue ¶
func (s *Symlink) ConcreteValue(ignore func(string) bool, sourceDir string, umask os.FileMode, recursive bool) (interface{}, error)
ConcreteValue implements Entry.ConcreteValue.
func (*Symlink) SourceName ¶
SourceName implements Entry.SourceName.
func (*Symlink) TargetName ¶
TargetName implements Entry.TargetName.
type TargetState ¶
type TargetState struct { DestDir string Entries map[string]Entry GPG *GPG MinVersion *semver.Version SourceDir string TargetIgnore *PatternSet TargetRemove *PatternSet TemplateData map[string]interface{} TemplateFuncs template.FuncMap TemplateOptions []string Templates map[string]*template.Template Umask os.FileMode }
A TargetState represents the root target state.
func NewTargetState ¶
func NewTargetState(options ...TargetStateOption) *TargetState
NewTargetState creates a new TargetState with the given options.
func (*TargetState) Add ¶
func (ts *TargetState) Add(fs vfs.FS, addOptions AddOptions, targetPath string, info os.FileInfo, follow bool, mutator Mutator) error
Add adds a new target to ts.
func (*TargetState) AllEntries ¶ added in v1.8.0
func (ts *TargetState) AllEntries() []Entry
AllEntries returns all Entrys in ts.
func (*TargetState) Apply ¶
func (ts *TargetState) Apply(fs vfs.FS, mutator Mutator, follow bool, applyOptions *ApplyOptions) error
Apply ensures that ts.DestDir in fs matches ts.
func (*TargetState) ConcreteValue ¶
func (ts *TargetState) ConcreteValue(recursive bool) (interface{}, error)
ConcreteValue returns a value suitable for serialization.
func (*TargetState) Evaluate ¶
func (ts *TargetState) Evaluate() error
Evaluate evaluates all of the entries in ts.
func (*TargetState) ExecuteTemplateData ¶ added in v1.7.17
func (ts *TargetState) ExecuteTemplateData(name string, data []byte) ([]byte, error)
ExecuteTemplateData returns the result of executing template data.
func (*TargetState) Get ¶
Get returns the state of the given target, or nil if no such target is found.
func (*TargetState) ImportTAR ¶
func (ts *TargetState) ImportTAR(r *tar.Reader, importTAROptions ImportTAROptions, mutator Mutator) error
ImportTAR imports a tar archive.
func (*TargetState) Populate ¶
func (ts *TargetState) Populate(fs vfs.FS, options *PopulateOptions) error
Populate walks fs from ts.SourceDir to populate ts.
type TargetStateOption ¶ added in v1.7.17
type TargetStateOption func(*TargetState)
A TargetStateOption sets an option on a TargeState.
func WithDestDir ¶ added in v1.7.17
func WithDestDir(destDir string) TargetStateOption
WithDestDir sets DestDir.
func WithEntries ¶ added in v1.7.17
func WithEntries(entries map[string]Entry) TargetStateOption
WithEntries sets the entries.
func WithGPG ¶ added in v1.7.17
func WithGPG(gpg *GPG) TargetStateOption
WithGPG sets the GPG options.
func WithMinVersion ¶ added in v1.7.17
func WithMinVersion(minVersion *semver.Version) TargetStateOption
WithMinVersion sets the minimum version.
func WithSourceDir ¶ added in v1.7.17
func WithSourceDir(sourceDir string) TargetStateOption
WithSourceDir sets the source directory.
func WithTargetIgnore ¶ added in v1.7.17
func WithTargetIgnore(targetIgnore *PatternSet) TargetStateOption
WithTargetIgnore sets the target patterns to ignore.
func WithTargetRemove ¶ added in v1.7.17
func WithTargetRemove(targetRemove *PatternSet) TargetStateOption
WithTargetRemove sets the target patterns to remove.
func WithTemplateData ¶ added in v1.7.17
func WithTemplateData(templateData map[string]interface{}) TargetStateOption
WithTemplateData sets the template data.
func WithTemplateFuncs ¶ added in v1.7.17
func WithTemplateFuncs(templateFuncs template.FuncMap) TargetStateOption
WithTemplateFuncs sets the template functions.
func WithTemplateOptions ¶ added in v1.7.17
func WithTemplateOptions(templateOptions []string) TargetStateOption
WithTemplateOptions sets the template functions.
func WithTemplates ¶ added in v1.7.17
func WithTemplates(templates map[string]*template.Template) TargetStateOption
WithTemplates sets the templates.
func WithUmask ¶ added in v1.7.17
func WithUmask(umask os.FileMode) TargetStateOption
WithUmask sets the umask.
type VerboseMutator ¶
type VerboseMutator struct {
// contains filtered or unexported fields
}
A VerboseMutator wraps an Mutator and logs all of the actions it executes and any errors as pseudo shell commands.
func NewVerboseMutator ¶
NewVerboseMutator returns a new VerboseMutator.
func (*VerboseMutator) Chmod ¶
func (m *VerboseMutator) Chmod(name string, mode os.FileMode) error
Chmod implements Mutator.Chmod.
func (*VerboseMutator) IdempotentCmdOutput ¶
func (m *VerboseMutator) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
IdempotentCmdOutput implements Mutator.IdempotentCmdOutput.
func (*VerboseMutator) Mkdir ¶
func (m *VerboseMutator) Mkdir(name string, perm os.FileMode) error
Mkdir implements Mutator.Mkdir.
func (*VerboseMutator) RemoveAll ¶
func (m *VerboseMutator) RemoveAll(name string) error
RemoveAll implements Mutator.RemoveAll.
func (*VerboseMutator) Rename ¶
func (m *VerboseMutator) Rename(oldpath, newpath string) error
Rename implements Mutator.Rename.
func (*VerboseMutator) RunCmd ¶
func (m *VerboseMutator) RunCmd(cmd *exec.Cmd) error
RunCmd implements Mutator.RunCmd.
func (*VerboseMutator) Stat ¶
func (m *VerboseMutator) Stat(name string) (os.FileInfo, error)
Stat implements Mutator.Stat.
func (*VerboseMutator) WriteFile ¶
func (m *VerboseMutator) WriteFile(name string, data []byte, perm os.FileMode, currData []byte) error
WriteFile implements Mutator.WriteFile.
func (*VerboseMutator) WriteSymlink ¶
func (m *VerboseMutator) WriteSymlink(oldname, newname string) error
WriteSymlink implements Mutator.WriteSymlink.
Source Files ¶
- anymutator.go
- autotemplate.go
- boltpersistentstate.go
- chezmoi.go
- chezmoi_unix.go
- debugmutator.go
- dir.go
- doublestaros.go
- file.go
- fsmutator.go
- fsmutator_posix.go
- gitdiffmutator.go
- gpg.go
- maybeshellquote.go
- mutator.go
- nullmutator.go
- patternset.go
- private_posix.go
- script.go
- symlink.go
- targetstate.go
- targetstate_posix.go
- verbosemutator.go