chezmoi

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 49 Imported by: 0

Documentation

Overview

Package chezmoi contains chezmoi's core logic.

Index

Constants

View Source
const (
	Prefix = ".chezmoi"

	RootName    = Prefix + "root"
	VersionName = Prefix + "version"
)

Special file names.

View Source
const (
	TemplateSuffix = ".tmpl"
)

Prefixes and suffixes.

Variables

View Source
var (
	DotAbsPath   = NewAbsPath(".")
	EmptyAbsPath = NewAbsPath("")
	RootAbsPath  = NewAbsPath("/")
)
View Source
var (
	// DefaultTemplateOptions are the default template options.
	DefaultTemplateOptions = []string{"missingkey=error"}

	// Break indicates that a walk should be stopped.
	Break = io.EOF

	// Skip indicates that entry should be skipped.
	Skip = filepath.SkipDir

	// Umask is the process's umask.
	Umask = fs.FileMode(0)
)
View Source
var (
	// ConfigStateBucket is the bucket for recording the config state.
	ConfigStateBucket = []byte("configState")

	// EntryStateBucket is the bucket for recording the entry states.
	EntryStateBucket = []byte("entryState")
)
View Source
var (
	DotRelPath   = NewRelPath(".")
	EmptyRelPath = NewRelPath("")
)
View Source
var Formats = map[string]Format{
	"json": FormatJSON,
	"toml": FormatTOML,
	"yaml": FormatYAML,
}

Formats is a map of all Formats by name.

Functions

func CutBytes added in v2.9.5

func CutBytes(s, sep []byte) (before, after []byte, found bool)

CutBytes slices s around the first instance of sep, returning the text before and after sep. The found result reports whether sep appears in s. If sep does not appear in s, cut returns s, nil, false.

CutBytes returns slices of the original slice s, not copies.

func CutString added in v2.9.5

func CutString(s, sep string) (before, after string, found bool)

CutString slices s around the first instance of sep, returning the text before and after sep. The found result reports whether sep appears in s. If sep does not appear in s, cut returns s, "", false.

func DiffPatch

func DiffPatch(
	path RelPath,
	fromData []byte, fromMode fs.FileMode,
	toData []byte, toMode fs.FileMode,
) (diff.Patch, error)

DiffPatch returns a github.com/go-git/go-git/plumbing/format/diff.Patch for path from the given data and mode to the given data and mode.

func FQDNHostname

func FQDNHostname(fileSystem vfs.FS) string

FQDNHostname returns the FQDN hostname, if it can be determined.

func Kernel added in v2.1.2

func Kernel(fileSystem vfs.FS) (map[string]interface{}, error)

Kernel returns the kernel information parsed from /proc/sys/kernel.

func MkdirAll

func MkdirAll(system System, absPath AbsPath, perm fs.FileMode) error

MkdirAll is the equivalent of os.MkdirAll but operates on system.

func OSRelease

func OSRelease(system System) (map[string]interface{}, error)

OSRelease returns the operating system identification data as defined by the os-release specification.

func PersistentStateBucketData added in v2.9.0

func PersistentStateBucketData(s PersistentState, bucket []byte) (map[string]interface{}, error)

PersistentStateBucketData returns the state data in bucket in s.

func PersistentStateData

func PersistentStateData(s PersistentState) (interface{}, error)

PersistentStateData returns the structured data in s.

func RecursiveMerge

func RecursiveMerge(dest, source map[string]interface{})

RecursiveMerge recursively merges maps in source into dest.

func SHA256Sum

func SHA256Sum(data []byte) []byte

SHA256Sum returns the SHA256 sum of data.

func StringSliceToEntryTypeSetHookFunc

func StringSliceToEntryTypeSetHookFunc() mapstructure.DecodeHookFunc

StringSliceToEntryTypeSetHookFunc is a github.com/mitchellh/mapstructure.DecodeHookFunc that parses an EntryTypeSet from a []string.

func StringToAbsPathHookFunc added in v2.0.11

func StringToAbsPathHookFunc() mapstructure.DecodeHookFunc

StringToAbsPathHookFunc is a github.com/mitchellh/mapstructure.DecodeHookFunc that parses an AbsPath from a string.

func SuspiciousSourceDirEntry

func SuspiciousSourceDirEntry(base string, fileInfo fs.FileInfo) bool

SuspiciousSourceDirEntry returns true if base is a suspicious dir entry.

func Walk

func Walk(system System, rootAbsPath AbsPath, walkFunc WalkFunc) error

Walk walks rootAbsPath in system, alling walkFunc for each file or directory in the tree, including rootAbsPath.

Walk does not follow symlinks.

func WalkArchive added in v2.9.1

func WalkArchive(data []byte, format ArchiveFormat, f WalkArchiveFunc) error

WalkArchive walks over all the entries in an archive.

func WalkSourceDir added in v2.8.0

func WalkSourceDir(system System, sourceDirAbsPath AbsPath, walkFunc WalkSourceDirFunc) error

WalkSourceDir walks the source directory rooted at sourceDirAbsPath in system, calling walkFunc for each file or directory in the tree, including sourceDirAbsPath.

WalkSourceDir does not follow symbolic links found in directories, but if sourceDirAbsPath itself is a symbolic link, its target will be walked.

Directory entries .chezmoidata.<format> and .chezmoitemplates are visited before all other entries. All other entries are visited in alphabetical order.

Types

type AbsPath

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

An AbsPath is an absolute path.

func HomeDirAbsPath added in v2.7.4

func HomeDirAbsPath() (AbsPath, error)

HomeDirAbsPath returns the user's home directory as an AbsPath.

func NewAbsPath

func NewAbsPath(absPath string) AbsPath

NewAbsPath returns a new AbsPath.

func NewAbsPathFromExtPath

func NewAbsPathFromExtPath(extPath string, homeDirAbsPath AbsPath) (AbsPath, error)

NewAbsPathFromExtPath returns a new AbsPath by converting extPath to use slashes, performing tilde expansion, and making the path absolute.

func NormalizePath

func NormalizePath(path string) (AbsPath, error)

NormalizePath returns path normalized. On non-Windows systems, normalized paths are absolute paths.

func (AbsPath) Append added in v2.9.1

func (p AbsPath) Append(s string) AbsPath

Append appends s to p.

func (AbsPath) Base

func (p AbsPath) Base() string

Base returns p's basename.

func (AbsPath) Bytes added in v2.5.1

func (p AbsPath) Bytes() []byte

Bytes returns p as a []byte.

func (AbsPath) Dir

func (p AbsPath) Dir() AbsPath

Dir returns p's directory.

func (AbsPath) Empty added in v2.5.1

func (p AbsPath) Empty() bool

Empty returns if p is empty.

func (AbsPath) Ext added in v2.7.0

func (p AbsPath) Ext() string

Ext returns p's extension.

func (AbsPath) Join

func (p AbsPath) Join(relPaths ...RelPath) AbsPath

Join returns a new AbsPath with relPaths appended.

func (AbsPath) JoinString added in v2.7.4

func (p AbsPath) JoinString(ss ...string) AbsPath

JoinString returns a new AbsPath with ss appended.

func (AbsPath) Len added in v2.5.1

func (p AbsPath) Len() int

Len returns the length of p.

func (AbsPath) Less added in v2.7.5

func (p AbsPath) Less(other AbsPath) bool

Less returns if p is less than other.

func (AbsPath) MarshalText added in v2.5.1

func (p AbsPath) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.MarshalText.

func (AbsPath) MustTrimDirPrefix

func (p AbsPath) MustTrimDirPrefix(dirPrefix AbsPath) RelPath

MustTrimDirPrefix is like TrimPrefix but panics on any error.

func (*AbsPath) Set added in v2.0.11

func (p *AbsPath) Set(s string) error

Set implements github.com/spf13/pflag.Value.Set.

func (AbsPath) Split

func (p AbsPath) Split() (AbsPath, RelPath)

Split returns p's directory and file.

func (AbsPath) String added in v2.0.11

func (p AbsPath) String() string

func (AbsPath) ToSlash added in v2.5.1

func (p AbsPath) ToSlash() AbsPath

ToSlash calls filepath.ToSlash on p.

func (AbsPath) TrimDirPrefix

func (p AbsPath) TrimDirPrefix(dirPrefixAbsPath AbsPath) (RelPath, error)

TrimDirPrefix trims prefix from p.

func (AbsPath) Type added in v2.0.11

func (p AbsPath) Type() string

Type implements github.com/spf13/pflag.Value.Type.

func (*AbsPath) UnmarshalText added in v2.5.1

func (p *AbsPath) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.UnmarshalText.

type AbsPaths

type AbsPaths []AbsPath

AbsPaths is a slice of RelPaths that implements sort.Interface.

func (AbsPaths) Len

func (ps AbsPaths) Len() int

func (AbsPaths) Less

func (ps AbsPaths) Less(i, j int) bool

func (AbsPaths) Swap

func (ps AbsPaths) Swap(i, j int)

type ActualStateAbsent

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

A ActualStateAbsent represents the absence of an entry in the filesystem.

func (*ActualStateAbsent) EntryState

func (s *ActualStateAbsent) EntryState() (*EntryState, error)

EntryState returns s's entry state.

func (*ActualStateAbsent) Path

func (s *ActualStateAbsent) Path() AbsPath

Path returns s's path.

func (*ActualStateAbsent) Remove

func (s *ActualStateAbsent) Remove(system System) error

Remove removes s.

type ActualStateDir

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

A ActualStateDir represents the state of a directory in the filesystem.

func (*ActualStateDir) EntryState

func (s *ActualStateDir) EntryState() (*EntryState, error)

EntryState returns s's entry state.

func (*ActualStateDir) Path

func (s *ActualStateDir) Path() AbsPath

Path returns s's path.

func (*ActualStateDir) Remove

func (s *ActualStateDir) Remove(system System) error

Remove removes s.

type ActualStateEntry

type ActualStateEntry interface {
	EntryState() (*EntryState, error)
	Path() AbsPath
	Remove(system System) error
}

An ActualStateEntry represents the actual state of an entry in the filesystem.

func NewActualStateEntry

func NewActualStateEntry(system System, absPath AbsPath, fileInfo fs.FileInfo, err error) (ActualStateEntry, error)

NewActualStateEntry returns a new ActualStateEntry populated with absPath from system.

type ActualStateFile

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

A ActualStateFile represents the state of a file in the filesystem.

func (ActualStateFile) Contents

func (lc ActualStateFile) Contents() ([]byte, error)

Contents returns lc's contents.

func (ActualStateFile) ContentsSHA256

func (lc ActualStateFile) ContentsSHA256() ([]byte, error)

ContentsSHA256 returns the SHA256 sum of lc's contents.

func (*ActualStateFile) EntryState

func (s *ActualStateFile) EntryState() (*EntryState, error)

EntryState returns s's entry state.

func (*ActualStateFile) Path

func (s *ActualStateFile) Path() AbsPath

Path returns s's path.

func (*ActualStateFile) Perm added in v2.0.13

func (s *ActualStateFile) Perm() fs.FileMode

Perm returns s's perm.

func (*ActualStateFile) Remove

func (s *ActualStateFile) Remove(system System) error

Remove removes s.

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

A ActualStateSymlink represents the state of a symlink in the filesystem.

func (*ActualStateSymlink) EntryState

func (s *ActualStateSymlink) EntryState() (*EntryState, error)

EntryState returns s's entry state.

func (ActualStateSymlink) Linkname

func (ll ActualStateSymlink) Linkname() (string, error)

Linkname returns s's linkname.

func (ActualStateSymlink) LinknameSHA256

func (ll ActualStateSymlink) LinknameSHA256() ([]byte, error)

LinknameSHA256 returns the SHA256 sum of ll's linkname.

func (*ActualStateSymlink) Path

func (s *ActualStateSymlink) Path() AbsPath

Path returns s's path.

func (*ActualStateSymlink) Remove

func (s *ActualStateSymlink) Remove(system System) error

Remove removes s.

type AddOptions

type AddOptions struct {
	AutoTemplate     bool          // Automatically create templates, if possible.
	Create           bool          // Add create_ entries instead of normal entries.
	Empty            bool          // Add the empty_ attribute to added files.
	Encrypt          bool          // Encrypt files.
	EncryptedSuffix  string        // Suffix for encrypted files.
	Exact            bool          // Add the exact_ attribute to added directories.
	Include          *EntryTypeSet // Only add types in this set.
	PreAddFunc       PreAddFunc    // Function to be called before the source entry is added.
	RemoveDir        RelPath       // Directory to remove before adding.
	Template         bool          // Add the .tmpl attribute to added files.
	TemplateSymlinks bool          // Add symlinks with targets in the source or home directories as templates.
}

AddOptions are options to SourceState.Add.

type AgeEncryption added in v2.4.0

type AgeEncryption struct {
	UseBuiltin      bool
	BaseSystem      System
	Command         string
	Args            []string
	Identity        AbsPath
	Identities      []AbsPath
	Passphrase      bool
	Recipient       string
	Recipients      []string
	RecipientsFile  AbsPath
	RecipientsFiles []AbsPath
	Suffix          string
	Symmetric       bool
}

An AgeEncryption uses age for encryption and decryption. See https://age-encryption.org.

func (*AgeEncryption) Decrypt added in v2.4.0

func (e *AgeEncryption) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt implements Encyrption.Decrypt.

func (*AgeEncryption) DecryptToFile added in v2.4.0

func (e *AgeEncryption) DecryptToFile(plaintextAbsPath AbsPath, ciphertext []byte) error

DecryptToFile implements Encryption.DecryptToFile.

func (*AgeEncryption) Encrypt added in v2.4.0

func (e *AgeEncryption) Encrypt(plaintext []byte) ([]byte, error)

Encrypt implements Encryption.Encrypt.

func (*AgeEncryption) EncryptFile added in v2.4.0

func (e *AgeEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error)

EncryptFile implements Encryption.EncryptFile.

func (*AgeEncryption) EncryptedSuffix added in v2.4.0

func (e *AgeEncryption) EncryptedSuffix() string

EncryptedSuffix implements Encryption.EncryptedSuffix.

type ApplyOptions

type ApplyOptions struct {
	Include      *EntryTypeSet
	PreApplyFunc PreApplyFunc
	Umask        fs.FileMode
}

ApplyOptions are options to SourceState.ApplyAll and SourceState.ApplyOne.

type ArchiveFormat added in v2.5.0

type ArchiveFormat string

An ArchiveFormat is an archive format and implements the github.com/spf13/pflag.Value interface.

const (
	ArchiveFormatUnknown ArchiveFormat = ""
	ArchiveFormatTar     ArchiveFormat = "tar"
	ArchiveFormatTarBz2  ArchiveFormat = "tar.bz2"
	ArchiveFormatTarGz   ArchiveFormat = "tar.gz"
	ArchiveFormatTbz2    ArchiveFormat = "tbz2"
	ArchiveFormatTgz     ArchiveFormat = "tgz"
	ArchiveFormatZip     ArchiveFormat = "zip"
)

Archive formats.

func GuessArchiveFormat added in v2.5.0

func GuessArchiveFormat(path string, data []byte) ArchiveFormat

GuessArchiveFormat guesses the archive format from the path and data.

func (*ArchiveFormat) Set added in v2.5.0

func (f *ArchiveFormat) Set(s string) error

Set implements github.com/spf13/pflag.Value.Set.

func (ArchiveFormat) String added in v2.5.0

func (f ArchiveFormat) String() string

String implements github.com/spf13/pflag.Value.String.

func (ArchiveFormat) Type added in v2.5.0

func (f ArchiveFormat) Type() string

Type implements github.com/spf13/pflag.Value.Type.

type ArchiveReaderSystem added in v2.3.0

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

A ArchiveReaderSystem a system constructed from reading an archive.

func NewArchiveReaderSystem added in v2.3.0

func NewArchiveReaderSystem(
	archivePath string, data []byte, format ArchiveFormat, options ArchiveReaderSystemOptions,
) (*ArchiveReaderSystem, error)

NewArchiveReaderSystem returns a new ArchiveReaderSystem reading from data and using archivePath as a hint for the archive format.

func (ArchiveReaderSystem) Chmod added in v2.3.0

func (ArchiveReaderSystem) Chmod(name AbsPath, perm fs.FileMode) error

func (*ArchiveReaderSystem) FileInfos added in v2.3.0

func (s *ArchiveReaderSystem) FileInfos() map[AbsPath]fs.FileInfo

FileInfos returns s's fs.FileInfos.

func (ArchiveReaderSystem) Glob added in v2.3.0

func (ArchiveReaderSystem) Glob(pattern string) ([]string, error)

func (ArchiveReaderSystem) IdempotentCmdCombinedOutput added in v2.3.0

func (ArchiveReaderSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

func (ArchiveReaderSystem) IdempotentCmdOutput added in v2.3.0

func (ArchiveReaderSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
func (ArchiveReaderSystem) Link(oldname, newname AbsPath) error

func (*ArchiveReaderSystem) Lstat added in v2.3.0

func (s *ArchiveReaderSystem) Lstat(filename AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (ArchiveReaderSystem) Mkdir added in v2.3.0

func (ArchiveReaderSystem) Mkdir(name AbsPath, perm fs.FileMode) error

func (ArchiveReaderSystem) RawPath added in v2.3.0

func (ArchiveReaderSystem) RawPath(path AbsPath) (AbsPath, error)

func (ArchiveReaderSystem) ReadDir added in v2.3.0

func (ArchiveReaderSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

func (*ArchiveReaderSystem) ReadFile added in v2.3.0

func (s *ArchiveReaderSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *ArchiveReaderSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (ArchiveReaderSystem) RemoveAll added in v2.3.0

func (ArchiveReaderSystem) RemoveAll(name AbsPath) error

func (ArchiveReaderSystem) Rename added in v2.3.0

func (ArchiveReaderSystem) Rename(oldpath, newpath AbsPath) error

func (ArchiveReaderSystem) RunCmd added in v2.3.0

func (ArchiveReaderSystem) RunCmd(cmd *exec.Cmd) error

func (ArchiveReaderSystem) RunIdempotentCmd added in v2.3.0

func (ArchiveReaderSystem) RunIdempotentCmd(cmd *exec.Cmd) error

func (ArchiveReaderSystem) RunScript added in v2.3.0

func (ArchiveReaderSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

func (ArchiveReaderSystem) Stat added in v2.3.0

func (ArchiveReaderSystem) Stat(name AbsPath) (fs.FileInfo, error)

func (ArchiveReaderSystem) UnderlyingFS added in v2.3.0

func (ArchiveReaderSystem) UnderlyingFS() vfs.FS

func (ArchiveReaderSystem) WriteFile added in v2.3.0

func (ArchiveReaderSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
func (ArchiveReaderSystem) WriteSymlink(oldname string, newname AbsPath) error

type ArchiveReaderSystemOptions added in v2.3.0

type ArchiveReaderSystemOptions struct {
	RootAbsPath     AbsPath
	StripComponents int
}

ArchiveReaderSystemOptions are options to NewArchiveReaderSystem.

type BoltPersistentState

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

A BoltPersistentState is a state persisted with bolt.

func NewBoltPersistentState

func NewBoltPersistentState(system System, path AbsPath, mode BoltPersistentStateMode) (*BoltPersistentState, error)

NewBoltPersistentState returns a new BoltPersistentState.

func (*BoltPersistentState) Close

func (b *BoltPersistentState) Close() error

Close closes b.

func (*BoltPersistentState) CopyTo

CopyTo copies b to p.

func (*BoltPersistentState) Data

func (b *BoltPersistentState) Data() (interface{}, error)

Data returns all the data in b.

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) DeleteBucket added in v2.9.0

func (b *BoltPersistentState) DeleteBucket(bucket []byte) error

DeleteBucket deletes the bucket.

func (*BoltPersistentState) ForEach

func (b *BoltPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error

ForEach calls fn for each key, value pair in bucket.

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 BoltPersistentStateMode

type BoltPersistentStateMode int

A BoltPersistentStateMode is a mode for opening a PersistentState.

const (
	BoltPersistentStateReadOnly BoltPersistentStateMode = iota
	BoltPersistentStateReadWrite
)

Persistent state modes.

type DebugEncryption

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

A DebugEncryption logs all calls to an Encryption.

func NewDebugEncryption

func NewDebugEncryption(encryption Encryption, logger *zerolog.Logger) *DebugEncryption

NewDebugEncryption returns a new DebugEncryption that logs methods on encryption to logger.

func (*DebugEncryption) Decrypt

func (e *DebugEncryption) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt implements Encryption.Decrypt.

func (*DebugEncryption) DecryptToFile

func (e *DebugEncryption) DecryptToFile(plaintextAbsPath AbsPath, ciphertext []byte) error

DecryptToFile implements Encryption.DecryptToFile.

func (*DebugEncryption) Encrypt

func (e *DebugEncryption) Encrypt(plaintext []byte) ([]byte, error)

Encrypt implements Encryption.Encrypt.

func (*DebugEncryption) EncryptFile

func (e *DebugEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error)

EncryptFile implements Encryption.EncryptFile.

func (*DebugEncryption) EncryptedSuffix

func (e *DebugEncryption) EncryptedSuffix() string

EncryptedSuffix implements Encryption.EncryptedSuffix.

type DebugPersistentState

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

A DebugPersistentState logs calls to a PersistentState.

func NewDebugPersistentState

func NewDebugPersistentState(persistentState PersistentState, logger *zerolog.Logger) *DebugPersistentState

NewDebugPersistentState returns a new debugPersistentState that logs methods on persistentState to logger.

func (*DebugPersistentState) Close

func (s *DebugPersistentState) Close() error

Close implements PersistentState.Close.

func (*DebugPersistentState) CopyTo

CopyTo implements PersistentState.CopyTo.

func (*DebugPersistentState) Data

func (s *DebugPersistentState) Data() (interface{}, error)

Data implements PersistentState.Data.

func (*DebugPersistentState) Delete

func (s *DebugPersistentState) Delete(bucket, key []byte) error

Delete implements PersistentState.Delete.

func (*DebugPersistentState) DeleteBucket added in v2.9.0

func (s *DebugPersistentState) DeleteBucket(bucket []byte) error

DeleteBucket implements PersistentState.DeleteBucket.

func (*DebugPersistentState) ForEach

func (s *DebugPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error

ForEach implements PersistentState.ForEach.

func (*DebugPersistentState) Get

func (s *DebugPersistentState) Get(bucket, key []byte) ([]byte, error)

Get implements PersistentState.Get.

func (*DebugPersistentState) Set

func (s *DebugPersistentState) Set(bucket, key, value []byte) error

Set implements PersistentState.Set.

type DebugSystem

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

A DebugSystem logs all calls to a System.

func NewDebugSystem

func NewDebugSystem(system System, logger *zerolog.Logger) *DebugSystem

NewDebugSystem returns a new DebugSystem that logs methods on system to logger.

func (*DebugSystem) Chmod

func (s *DebugSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*DebugSystem) Glob

func (s *DebugSystem) Glob(name string) ([]string, error)

Glob implements System.Glob.

func (*DebugSystem) IdempotentCmdCombinedOutput

func (s *DebugSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*DebugSystem) IdempotentCmdOutput

func (s *DebugSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *DebugSystem) Link(oldpath, newpath AbsPath) error

Link implements System.Link.

func (*DebugSystem) Lstat

func (s *DebugSystem) Lstat(name AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*DebugSystem) Mkdir

func (s *DebugSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*DebugSystem) RawPath

func (s *DebugSystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*DebugSystem) ReadDir

func (s *DebugSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*DebugSystem) ReadFile

func (s *DebugSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *DebugSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*DebugSystem) RemoveAll

func (s *DebugSystem) RemoveAll(name AbsPath) error

RemoveAll implements System.RemoveAll.

func (*DebugSystem) Rename

func (s *DebugSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*DebugSystem) RunCmd

func (s *DebugSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*DebugSystem) RunIdempotentCmd added in v2.1.5

func (s *DebugSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*DebugSystem) RunScript

func (s *DebugSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (*DebugSystem) Stat

func (s *DebugSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*DebugSystem) UnderlyingFS

func (s *DebugSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*DebugSystem) WriteFile

func (s *DebugSystem) WriteFile(name AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *DebugSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type DirAttr

type DirAttr struct {
	TargetName string
	Exact      bool
	Private    bool
	ReadOnly   bool
}

DirAttr holds attributes parsed from a source directory name.

func (DirAttr) MarshalZerologObject added in v2.5.0

func (da DirAttr) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.ObjectMarshaler.MarshalZerologObject.

func (DirAttr) SourceName

func (da DirAttr) SourceName() string

SourceName returns da's source name.

type DryRunSystem

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

DryRunSystem is an System that reads from, but does not write to, to a wrapped System.

func NewDryRunSystem

func NewDryRunSystem(system System) *DryRunSystem

NewDryRunSystem returns a new DryRunSystem that wraps fs.

func (*DryRunSystem) Chmod

func (s *DryRunSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*DryRunSystem) Glob

func (s *DryRunSystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*DryRunSystem) IdempotentCmdCombinedOutput

func (s *DryRunSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*DryRunSystem) IdempotentCmdOutput

func (s *DryRunSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *DryRunSystem) Link(oldname, newname AbsPath) error

Link implements System.Link.

func (*DryRunSystem) Lstat

func (s *DryRunSystem) Lstat(name AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*DryRunSystem) Mkdir

func (s *DryRunSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*DryRunSystem) Modified

func (s *DryRunSystem) Modified() bool

Modified returns true if a method that would have modified the wrapped system has been called.

func (*DryRunSystem) RawPath

func (s *DryRunSystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*DryRunSystem) ReadDir

func (s *DryRunSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*DryRunSystem) ReadFile

func (s *DryRunSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *DryRunSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*DryRunSystem) RemoveAll

func (s *DryRunSystem) RemoveAll(AbsPath) error

RemoveAll implements System.RemoveAll.

func (*DryRunSystem) Rename

func (s *DryRunSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*DryRunSystem) RunCmd

func (s *DryRunSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*DryRunSystem) RunIdempotentCmd added in v2.1.5

func (s *DryRunSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*DryRunSystem) RunScript

func (s *DryRunSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (*DryRunSystem) Stat

func (s *DryRunSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*DryRunSystem) UnderlyingFS

func (s *DryRunSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*DryRunSystem) WriteFile

func (s *DryRunSystem) WriteFile(AbsPath, []byte, fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *DryRunSystem) WriteSymlink(string, AbsPath) error

WriteSymlink implements System.WriteSymlink.

type DumpSystem

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

A DumpSystem is a System that writes to a data file.

func NewDumpSystem

func NewDumpSystem() *DumpSystem

NewDumpSystem returns a new DumpSystem that accumulates data.

func (DumpSystem) Chmod

func (DumpSystem) Chmod(name AbsPath, perm fs.FileMode) error

func (*DumpSystem) Data

func (s *DumpSystem) Data() interface{}

Data returns s's data.

func (DumpSystem) Glob

func (DumpSystem) Glob(pattern string) ([]string, error)

func (DumpSystem) IdempotentCmdCombinedOutput

func (DumpSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

func (DumpSystem) IdempotentCmdOutput

func (DumpSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
func (DumpSystem) Link(oldname, newname AbsPath) error

func (DumpSystem) Lstat

func (DumpSystem) Lstat(name AbsPath) (fs.FileInfo, error)

func (*DumpSystem) Mkdir

func (s *DumpSystem) Mkdir(dirname AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (DumpSystem) RawPath

func (DumpSystem) RawPath(path AbsPath) (AbsPath, error)

func (DumpSystem) ReadDir

func (DumpSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

func (DumpSystem) ReadFile

func (DumpSystem) ReadFile(name AbsPath) ([]byte, error)
func (DumpSystem) Readlink(name AbsPath) (string, error)

func (DumpSystem) RemoveAll

func (DumpSystem) RemoveAll(name AbsPath) error

func (DumpSystem) Rename

func (DumpSystem) Rename(oldpath, newpath AbsPath) error

func (DumpSystem) RunCmd

func (DumpSystem) RunCmd(cmd *exec.Cmd) error

func (DumpSystem) RunIdempotentCmd added in v2.1.5

func (DumpSystem) RunIdempotentCmd(cmd *exec.Cmd) error

func (*DumpSystem) RunScript

func (s *DumpSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (DumpSystem) Stat

func (DumpSystem) Stat(name AbsPath) (fs.FileInfo, error)

func (*DumpSystem) UnderlyingFS

func (s *DumpSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*DumpSystem) WriteFile

func (s *DumpSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *DumpSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type Encryption

type Encryption interface {
	Decrypt(ciphertext []byte) ([]byte, error)
	DecryptToFile(plaintextFilename AbsPath, ciphertext []byte) error
	Encrypt(plaintext []byte) ([]byte, error)
	EncryptFile(plaintextFilename AbsPath) ([]byte, error)
	EncryptedSuffix() string
}

An Encryption encrypts and decrypts files and data.

type EntryState

type EntryState struct {
	Type           EntryStateType `json:"type" toml:"type" yaml:"type"`
	Mode           fs.FileMode    `json:"mode,omitempty" toml:"mode,omitempty" yaml:"mode,omitempty"`
	ContentsSHA256 HexBytes       `json:"contentsSHA256,omitempty" toml:"contentsSHA256,omitempty" yaml:"contentsSHA256,omitempty"` //nolint:lll,tagliatelle
	// contains filtered or unexported fields
}

An EntryState represents the state of an entry. A nil EntryState is equivalent to EntryStateTypeAbsent.

func (*EntryState) Contents

func (s *EntryState) Contents() []byte

Contents returns s's contents, if available.

func (*EntryState) Equal

func (s *EntryState) Equal(other *EntryState) bool

Equal returns true if s is equal to other.

func (*EntryState) Equivalent

func (s *EntryState) Equivalent(other *EntryState) bool

Equivalent returns true if s is equivalent to other.

func (*EntryState) MarshalZerologObject added in v2.3.0

func (s *EntryState) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.

func (*EntryState) Overwrite added in v2.1.2

func (s *EntryState) Overwrite() bool

Overwrite returns true if s should be overwritten by default.

type EntryStateType

type EntryStateType string

An EntryStateType is an entry state type.

const (
	EntryStateTypeDir     EntryStateType = "dir"
	EntryStateTypeFile    EntryStateType = "file"
	EntryStateTypeSymlink EntryStateType = "symlink"
	EntryStateTypeRemove  EntryStateType = "remove"
	EntryStateTypeScript  EntryStateType = "script"
)

Entry state types.

type EntryTypeBits

type EntryTypeBits int

An EntryTypeBits is a bitmask of entry types.

const (
	EntryTypeDirs EntryTypeBits = 1 << iota
	EntryTypeFiles
	EntryTypeRemove
	EntryTypeScripts
	EntryTypeSymlinks
	EntryTypeEncrypted

	// EntryTypesAll is all entry types.
	EntryTypesAll EntryTypeBits = EntryTypeDirs |
		EntryTypeFiles |
		EntryTypeRemove |
		EntryTypeScripts |
		EntryTypeSymlinks |
		EntryTypeEncrypted

	// EntryTypesNone is no entry types.
	EntryTypesNone EntryTypeBits = 0
)

Entry type bits.

type EntryTypeSet

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

An EntryTypeSet is a set of entry types. It parses and prints as a comma-separated list of strings, but is internally represented as a bitmask. *EntryTypeSet implements the github.com/spf13/pflag.Value interface.

func NewEntryTypeSet

func NewEntryTypeSet(bits EntryTypeBits) *EntryTypeSet

NewEntryTypeSet returns a new IncludeSet.

func (*EntryTypeSet) Include added in v2.9.0

func (s *EntryTypeSet) Include(b EntryTypeBits) bool

Include returns if s includes b.

func (*EntryTypeSet) IncludeEncrypted

func (s *EntryTypeSet) IncludeEncrypted() bool

IncludeEncrypted returns true if s includes encrypted files.

func (*EntryTypeSet) IncludeFileInfo

func (s *EntryTypeSet) IncludeFileInfo(fileInfo fs.FileInfo) bool

IncludeFileInfo returns true if the type of fileInfo is a member.

func (*EntryTypeSet) IncludeTargetStateEntry

func (s *EntryTypeSet) IncludeTargetStateEntry(targetStateEntry TargetStateEntry) bool

IncludeTargetStateEntry returns true if type of targetStateEntry is a member.

func (*EntryTypeSet) Set

func (s *EntryTypeSet) Set(str string) error

Set implements github.com/spf13/pflag.Value.Set.

func (*EntryTypeSet) SetSlice

func (s *EntryTypeSet) SetSlice(ss []string) error

SetSlice sets s from a []string.

func (*EntryTypeSet) String

func (s *EntryTypeSet) String() string

String implements github.com/spf13/pflag.Value.String.

func (*EntryTypeSet) Sub

func (s *EntryTypeSet) Sub(other *EntryTypeSet) *EntryTypeSet

Sub returns a copy of s with the elements of other removed.

func (*EntryTypeSet) Type

func (s *EntryTypeSet) Type() string

Type implements github.com/spf13/pflag.Value.Type.

type ErrorOnWriteSystem added in v2.9.5

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

An ErrorOnWriteSystem is an System that passes reads to the wrapped System and returns an error if it is written to.

func NewErrorOnWriteSystem added in v2.9.5

func NewErrorOnWriteSystem(system System, err error) *ErrorOnWriteSystem

NewErrorOnWriteSystem returns a new ErrorOnWriteSystem that wraps fs.

func (*ErrorOnWriteSystem) Chmod added in v2.9.5

func (s *ErrorOnWriteSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*ErrorOnWriteSystem) Glob added in v2.9.5

func (s *ErrorOnWriteSystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*ErrorOnWriteSystem) IdempotentCmdCombinedOutput added in v2.9.5

func (s *ErrorOnWriteSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*ErrorOnWriteSystem) IdempotentCmdOutput added in v2.9.5

func (s *ErrorOnWriteSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *ErrorOnWriteSystem) Link(oldname, newname AbsPath) error

Link implements System.Link.

func (*ErrorOnWriteSystem) Lstat added in v2.9.5

func (s *ErrorOnWriteSystem) Lstat(name AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*ErrorOnWriteSystem) Mkdir added in v2.9.5

func (s *ErrorOnWriteSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*ErrorOnWriteSystem) RawPath added in v2.9.5

func (s *ErrorOnWriteSystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*ErrorOnWriteSystem) ReadDir added in v2.9.5

func (s *ErrorOnWriteSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*ErrorOnWriteSystem) ReadFile added in v2.9.5

func (s *ErrorOnWriteSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *ErrorOnWriteSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*ErrorOnWriteSystem) RemoveAll added in v2.9.5

func (s *ErrorOnWriteSystem) RemoveAll(AbsPath) error

RemoveAll implements System.RemoveAll.

func (*ErrorOnWriteSystem) Rename added in v2.9.5

func (s *ErrorOnWriteSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*ErrorOnWriteSystem) RunCmd added in v2.9.5

func (s *ErrorOnWriteSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*ErrorOnWriteSystem) RunIdempotentCmd added in v2.9.5

func (s *ErrorOnWriteSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*ErrorOnWriteSystem) RunScript added in v2.9.5

func (s *ErrorOnWriteSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (*ErrorOnWriteSystem) Stat added in v2.9.5

func (s *ErrorOnWriteSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*ErrorOnWriteSystem) UnderlyingFS added in v2.9.5

func (s *ErrorOnWriteSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*ErrorOnWriteSystem) WriteFile added in v2.9.5

func (s *ErrorOnWriteSystem) WriteFile(AbsPath, []byte, fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *ErrorOnWriteSystem) WriteSymlink(string, AbsPath) error

WriteSymlink implements System.WriteSymlink.

type ExitCodeError added in v2.9.4

type ExitCodeError int

An ExitCodeError indicates the the main program should exit with the given code.

func (ExitCodeError) Error added in v2.9.4

func (e ExitCodeError) Error() string

type External added in v2.2.0

type External struct {
	Type       ExternalType `json:"type" toml:"type" yaml:"type"`
	Encrypted  bool         `json:"encrypted" toml:"encrypted" yaml:"encrypted"`
	Exact      bool         `json:"exact" toml:"exact" yaml:"exact"`
	Executable bool         `json:"executable" toml:"executable" yaml:"executable"`
	Filter     struct {
		Command string   `json:"command" toml:"command" yaml:"command"`
		Args    []string `json:"args" toml:"args" yaml:"args"`
	} `json:"filter" toml:"filter" yaml:"filter"`
	Format          ArchiveFormat `json:"format" toml:"format" yaml:"format"`
	RefreshPeriod   time.Duration `json:"refreshPeriod" toml:"refreshPeriod" yaml:"refreshPeriod"`
	StripComponents int           `json:"stripComponents" toml:"stripComponents" yaml:"stripComponents"`
	URL             string        `json:"url" toml:"url" yaml:"url"`
}

An External is an external source.

type ExternalDiffSystem added in v2.1.5

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

An ExternalDiffSystem is a DiffSystem that uses an external diff tool.

func NewExternalDiffSystem added in v2.1.5

func NewExternalDiffSystem(
	system System, command string, args []string, destDirAbsPath AbsPath, options *ExternalDiffSystemOptions,
) *ExternalDiffSystem

NewExternalDiffSystem creates a new ExternalDiffSystem.

func (*ExternalDiffSystem) Chmod added in v2.1.5

func (s *ExternalDiffSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*ExternalDiffSystem) Close added in v2.1.5

func (s *ExternalDiffSystem) Close() error

Close frees all resources held by s.

func (*ExternalDiffSystem) Glob added in v2.1.5

func (s *ExternalDiffSystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*ExternalDiffSystem) IdempotentCmdCombinedOutput added in v2.1.5

func (s *ExternalDiffSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*ExternalDiffSystem) IdempotentCmdOutput added in v2.1.5

func (s *ExternalDiffSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *ExternalDiffSystem) Link(oldname, newname AbsPath) error

Link implements System.Link.

func (*ExternalDiffSystem) Lstat added in v2.1.5

func (s *ExternalDiffSystem) Lstat(name AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*ExternalDiffSystem) Mkdir added in v2.1.5

func (s *ExternalDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*ExternalDiffSystem) RawPath added in v2.1.5

func (s *ExternalDiffSystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*ExternalDiffSystem) ReadDir added in v2.1.5

func (s *ExternalDiffSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*ExternalDiffSystem) ReadFile added in v2.1.5

func (s *ExternalDiffSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *ExternalDiffSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*ExternalDiffSystem) RemoveAll added in v2.1.5

func (s *ExternalDiffSystem) RemoveAll(name AbsPath) error

RemoveAll implements System.RemoveAll.

func (*ExternalDiffSystem) Rename added in v2.1.5

func (s *ExternalDiffSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*ExternalDiffSystem) RunCmd added in v2.1.5

func (s *ExternalDiffSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*ExternalDiffSystem) RunIdempotentCmd added in v2.1.5

func (s *ExternalDiffSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*ExternalDiffSystem) RunScript added in v2.1.5

func (s *ExternalDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (*ExternalDiffSystem) Stat added in v2.1.5

func (s *ExternalDiffSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*ExternalDiffSystem) UnderlyingFS added in v2.1.5

func (s *ExternalDiffSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*ExternalDiffSystem) WriteFile added in v2.1.5

func (s *ExternalDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *ExternalDiffSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type ExternalDiffSystemOptions added in v2.8.0

type ExternalDiffSystemOptions struct {
	Reverse bool
}

ExternalDiffSystemOptions are options for NewExternalDiffSystem.

type ExternalType added in v2.2.0

type ExternalType string

An ExternalType is a type of external source.

const (
	ExternalTypeArchive ExternalType = "archive"
	ExternalTypeFile    ExternalType = "file"
)

ExternalTypes.

type FileAttr

type FileAttr struct {
	TargetName string
	Type       SourceFileTargetType
	Condition  ScriptCondition
	Empty      bool
	Encrypted  bool
	Executable bool
	Order      ScriptOrder
	Private    bool
	ReadOnly   bool
	Template   bool
}

A FileAttr holds attributes parsed from a source file name.

func (FileAttr) MarshalZerologObject added in v2.5.0

func (fa FileAttr) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.

func (FileAttr) SourceName

func (fa FileAttr) SourceName(encryptedSuffix string) string

SourceName returns fa's source name.

type Format

type Format interface {
	Marshal(value interface{}) ([]byte, error)
	Name() string
	Unmarshal(data []byte, value interface{}) error
}

A Format is a serialization format.

var (
	FormatJSON Format = formatJSON{}
	FormatTOML Format = formatTOML{}
	FormatYAML Format = formatYAML{}
)

Formats.

type GPGEncryption

type GPGEncryption struct {
	Command   string
	Args      []string
	Recipient string
	Symmetric bool
	Suffix    string
}

A GPGEncryption uses gpg for encryption and decryption. See https://gnupg.org/.

func (*GPGEncryption) Decrypt

func (e *GPGEncryption) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt implements Encyrption.Decrypt.

func (*GPGEncryption) DecryptToFile

func (e *GPGEncryption) DecryptToFile(plaintextFilename AbsPath, ciphertext []byte) error

DecryptToFile implements Encryption.DecryptToFile.

func (*GPGEncryption) Encrypt

func (e *GPGEncryption) Encrypt(plaintext []byte) ([]byte, error)

Encrypt implements Encryption.Encrypt.

func (*GPGEncryption) EncryptFile

func (e *GPGEncryption) EncryptFile(plaintextFilename AbsPath) ([]byte, error)

EncryptFile implements Encryption.EncryptFile.

func (*GPGEncryption) EncryptedSuffix

func (e *GPGEncryption) EncryptedSuffix() string

EncryptedSuffix implements Encryption.EncryptedSuffix.

type GitDiffSystem

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

A GitDiffSystem wraps a System and logs all of the actions executed as a git diff.

func NewGitDiffSystem

func NewGitDiffSystem(system System, w io.Writer, dirAbsPath AbsPath, options *GitDiffSystemOptions) *GitDiffSystem

NewGitDiffSystem returns a new GitDiffSystem. Output is written to w, the dirAbsPath is stripped from paths, and color controls whether the output contains ANSI color escape sequences.

func (*GitDiffSystem) Chmod

func (s *GitDiffSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*GitDiffSystem) Glob

func (s *GitDiffSystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*GitDiffSystem) IdempotentCmdCombinedOutput

func (s *GitDiffSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*GitDiffSystem) IdempotentCmdOutput

func (s *GitDiffSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *GitDiffSystem) Link(oldname, newname AbsPath) error

Link implements System.Link.

func (*GitDiffSystem) Lstat

func (s *GitDiffSystem) Lstat(name AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*GitDiffSystem) Mkdir

func (s *GitDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*GitDiffSystem) RawPath

func (s *GitDiffSystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*GitDiffSystem) ReadDir

func (s *GitDiffSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*GitDiffSystem) ReadFile

func (s *GitDiffSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *GitDiffSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*GitDiffSystem) RemoveAll

func (s *GitDiffSystem) RemoveAll(name AbsPath) error

RemoveAll implements System.RemoveAll.

func (*GitDiffSystem) Rename

func (s *GitDiffSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*GitDiffSystem) RunCmd

func (s *GitDiffSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*GitDiffSystem) RunIdempotentCmd added in v2.1.5

func (s *GitDiffSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*GitDiffSystem) RunScript

func (s *GitDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (*GitDiffSystem) Stat

func (s *GitDiffSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*GitDiffSystem) UnderlyingFS

func (s *GitDiffSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*GitDiffSystem) WriteFile

func (s *GitDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *GitDiffSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type GitDiffSystemOptions added in v2.8.0

type GitDiffSystemOptions struct {
	Color   bool
	Include *EntryTypeSet
	Reverse bool
}

GetDiffSystemOptions are options for NewGitDiffSystem.

type HexBytes

type HexBytes []byte

A HexBytes is a []byte which is marshaled as a hex string.

func (HexBytes) Bytes added in v2.7.0

func (h HexBytes) Bytes() []byte

Bytes returns h as a []byte.

func (HexBytes) MarshalText

func (h HexBytes) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.MarshalText.

func (HexBytes) String added in v2.3.0

func (h HexBytes) String() string

func (*HexBytes) UnmarshalText

func (h *HexBytes) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.UnmarshalText.

type Interpreter added in v2.0.14

type Interpreter struct {
	Command string   `mapstructure:"command"`
	Args    []string `mapstructure:"args"`
}

An Interpreter interprets scripts.

func (*Interpreter) ExecCommand added in v2.0.14

func (i *Interpreter) ExecCommand(name string) *exec.Cmd

ExecCommand returns the *exec.Cmd to interpret name.

func (*Interpreter) MarshalZerologObject added in v2.0.14

func (i *Interpreter) MarshalZerologObject(event *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.

func (*Interpreter) None added in v2.0.14

func (i *Interpreter) None() bool

None returns if i represents no interpreter.

type InvalidArchiveFormatError added in v2.5.0

type InvalidArchiveFormatError string

func (InvalidArchiveFormatError) Error added in v2.5.0

type MockPersistentState

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

A MockPersistentState is a mock persistent state.

func NewMockPersistentState

func NewMockPersistentState() *MockPersistentState

NewMockPersistentState returns a new PersistentState.

func (*MockPersistentState) Close

func (s *MockPersistentState) Close() error

Close closes s.

func (*MockPersistentState) CopyTo

CopyTo implements PersistentState.CopyTo.

func (*MockPersistentState) Data

func (s *MockPersistentState) Data() (interface{}, error)

Data implements PersistentState.Data.

func (*MockPersistentState) Delete

func (s *MockPersistentState) Delete(bucket, key []byte) error

Delete implements PersistentState.Delete.

func (*MockPersistentState) DeleteBucket added in v2.9.0

func (s *MockPersistentState) DeleteBucket(bucket []byte) error

DeleteBucket implements PersistentState.DeleteBucket.

func (*MockPersistentState) ForEach

func (s *MockPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error

ForEach implements PersistentState.ForEach.

func (*MockPersistentState) Get

func (s *MockPersistentState) Get(bucket, key []byte) ([]byte, error)

Get implements PersistentState.Get.

func (*MockPersistentState) Set

func (s *MockPersistentState) Set(bucket, key, value []byte) error

Set implements PersistentState.Set.

type Mode added in v2.1.5

type Mode string

A Mode is a mode of operation. It implements the github.com/spf13/flag.Value interface.

const (
	ModeFile    Mode = "file"
	ModeSymlink Mode = "symlink"
)

Modes.

func (*Mode) Set added in v2.1.5

func (m *Mode) Set(s string) error

Set implements github.com/spf13/flag.Value.Set.

func (Mode) String added in v2.1.5

func (m Mode) String() string

String implements github.com/spf13/flag.Value.String.

func (Mode) Type added in v2.1.5

func (m Mode) Type() string

Type implements github.com/spf13/flag.Value.Type.

type NoEncryption

type NoEncryption struct{}

NoEncryption returns an error when any method is called.

func (NoEncryption) Decrypt

func (NoEncryption) Decrypt([]byte) ([]byte, error)

Decrypt implements Encryption.Decrypt.

func (NoEncryption) DecryptToFile

func (NoEncryption) DecryptToFile(AbsPath, []byte) error

DecryptToFile implements Encryption.DecryptToFile.

func (NoEncryption) Encrypt

func (NoEncryption) Encrypt([]byte) ([]byte, error)

Encrypt implements Encryption.Encrypt.

func (NoEncryption) EncryptFile

func (NoEncryption) EncryptFile(AbsPath) ([]byte, error)

EncryptFile implements Encryption.EncryptFile.

func (NoEncryption) EncryptedSuffix

func (NoEncryption) EncryptedSuffix() string

EncryptedSuffix implements Encryption.EncryptedSuffix.

type NullPersistentState

type NullPersistentState struct{}

A NullPersistentState is an empty PersistentState that returns the zero value for all reads and silently consumes all writes.

func (NullPersistentState) Close

func (NullPersistentState) Close() error

Close does nothing.

func (NullPersistentState) CopyTo

CopyTo does nothing.

func (NullPersistentState) Data

func (NullPersistentState) Data() (interface{}, error)

Data does nothing.

func (NullPersistentState) Delete

func (NullPersistentState) Delete(bucket, key []byte) error

Delete does nothing.

func (NullPersistentState) DeleteBucket added in v2.9.0

func (NullPersistentState) DeleteBucket(bucket []byte) error

DeleteBucket does nothing.

func (NullPersistentState) ForEach

func (NullPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error

ForEach does nothing.

func (NullPersistentState) Get

func (NullPersistentState) Get(bucket, key []byte) ([]byte, error)

Get does nothing.

func (NullPersistentState) Set

func (NullPersistentState) Set(bucket, key, value []byte) error

Set does nothing.

type PersistentState

type PersistentState interface {
	Close() error
	CopyTo(s PersistentState) error
	Data() (interface{}, error)
	Delete(bucket, key []byte) error
	DeleteBucket(bucket []byte) error
	ForEach(bucket []byte, fn func(k, v []byte) error) error
	Get(bucket, key []byte) ([]byte, error)
	Set(bucket, key, value []byte) error
}

A PersistentState is a persistent state.

type PreAddFunc added in v2.0.11

type PreAddFunc func(targetRelPath RelPath, newSourceStateEntry, oldSourceStateEntry SourceStateEntry) error

A PreAddFunc is called before a new source state entry is added.

type PreApplyFunc

type PreApplyFunc func(
	targetRelPath RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *EntryState,
) error

A PreApplyFunc is called before a target is applied.

type ReadOnlySystem

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

A ReadOnlySystem is a system that may only be read from.

func NewReadOnlySystem

func NewReadOnlySystem(system System) *ReadOnlySystem

NewReadOnlySystem returns a new ReadOnlySystem that wraps system.

func (ReadOnlySystem) Chmod

func (ReadOnlySystem) Chmod(name AbsPath, perm fs.FileMode) error

func (*ReadOnlySystem) Glob

func (s *ReadOnlySystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*ReadOnlySystem) IdempotentCmdCombinedOutput

func (s *ReadOnlySystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*ReadOnlySystem) IdempotentCmdOutput

func (s *ReadOnlySystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (ReadOnlySystem) Link(oldname, newname AbsPath) error

func (*ReadOnlySystem) Lstat

func (s *ReadOnlySystem) Lstat(filename AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (ReadOnlySystem) Mkdir

func (ReadOnlySystem) Mkdir(name AbsPath, perm fs.FileMode) error

func (*ReadOnlySystem) RawPath

func (s *ReadOnlySystem) RawPath(path AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*ReadOnlySystem) ReadDir

func (s *ReadOnlySystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*ReadOnlySystem) ReadFile

func (s *ReadOnlySystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *ReadOnlySystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (ReadOnlySystem) RemoveAll

func (ReadOnlySystem) RemoveAll(name AbsPath) error

func (ReadOnlySystem) Rename

func (ReadOnlySystem) Rename(oldpath, newpath AbsPath) error

func (ReadOnlySystem) RunCmd

func (ReadOnlySystem) RunCmd(cmd *exec.Cmd) error

func (*ReadOnlySystem) RunIdempotentCmd added in v2.1.5

func (s *ReadOnlySystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (ReadOnlySystem) RunScript

func (ReadOnlySystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

func (*ReadOnlySystem) Stat

func (s *ReadOnlySystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*ReadOnlySystem) UnderlyingFS

func (s *ReadOnlySystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (ReadOnlySystem) WriteFile

func (ReadOnlySystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
func (ReadOnlySystem) WriteSymlink(oldname string, newname AbsPath) error

type ReadOptions added in v2.2.0

type ReadOptions struct {
	RefreshExternals bool
	TimeNow          func() time.Time
}

ReadOptions are options to SourceState.Read.

type RealSystem

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

An RealSystem is a System that writes to a filesystem and executes scripts.

func NewRealSystem

func NewRealSystem(fileSystem vfs.FS, options ...RealSystemOption) *RealSystem

NewRealSystem returns a System that acts on fileSystem.

func (*RealSystem) Chmod

func (s *RealSystem) Chmod(name AbsPath, mode fs.FileMode) error

Chmod implements System.Chmod.

func (*RealSystem) Glob

func (s *RealSystem) Glob(pattern string) ([]string, error)

Glob implements System.Glob.

func (*RealSystem) IdempotentCmdCombinedOutput

func (s *RealSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdCombinedOutput implements System.IdempotentCmdCombinedOutput.

func (*RealSystem) IdempotentCmdOutput

func (s *RealSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)

IdempotentCmdOutput implements System.IdempotentCmdOutput.

func (s *RealSystem) Link(oldname, newname AbsPath) error

Link implements System.Link.

func (*RealSystem) Lstat

func (s *RealSystem) Lstat(filename AbsPath) (fs.FileInfo, error)

Lstat implements System.Lstat.

func (*RealSystem) Mkdir

func (s *RealSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (*RealSystem) RawPath

func (s *RealSystem) RawPath(absPath AbsPath) (AbsPath, error)

RawPath implements System.RawPath.

func (*RealSystem) ReadDir

func (s *RealSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

ReadDir implements System.ReadDir.

func (*RealSystem) ReadFile

func (s *RealSystem) ReadFile(name AbsPath) ([]byte, error)

ReadFile implements System.ReadFile.

func (s *RealSystem) Readlink(name AbsPath) (string, error)

Readlink implements System.Readlink.

func (*RealSystem) RemoveAll

func (s *RealSystem) RemoveAll(name AbsPath) error

RemoveAll implements System.RemoveAll.

func (*RealSystem) Rename

func (s *RealSystem) Rename(oldpath, newpath AbsPath) error

Rename implements System.Rename.

func (*RealSystem) RunCmd

func (s *RealSystem) RunCmd(cmd *exec.Cmd) error

RunCmd implements System.RunCmd.

func (*RealSystem) RunIdempotentCmd added in v2.1.5

func (s *RealSystem) RunIdempotentCmd(cmd *exec.Cmd) error

RunIdempotentCmd implements System.RunIdempotentCmd.

func (*RealSystem) RunScript

func (s *RealSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) (err error)

RunScript implements System.RunScript.

func (*RealSystem) Stat

func (s *RealSystem) Stat(name AbsPath) (fs.FileInfo, error)

Stat implements System.Stat.

func (*RealSystem) UnderlyingFS

func (s *RealSystem) UnderlyingFS() vfs.FS

UnderlyingFS implements System.UnderlyingFS.

func (*RealSystem) WriteFile

func (s *RealSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) (err error)

WriteFile implements System.WriteFile.

func (s *RealSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type RealSystemOption added in v2.3.0

type RealSystemOption func(*RealSystem)

A RealSystemOption sets an option on a RealSystem.

func RealSystemWithSafe added in v2.3.0

func RealSystemWithSafe(safe bool) RealSystemOption

RealSystemWithSafe sets the safe flag of the RealSystem.

type RelPath

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

A RelPath is a relative path.

func NewRelPath added in v2.7.4

func NewRelPath(relPath string) RelPath

NewRelPath returns a new RelPath.

func (RelPath) AppendString added in v2.7.4

func (p RelPath) AppendString(s string) RelPath

AppendString appends s to p.

func (RelPath) Base

func (p RelPath) Base() string

Base returns p's base name.

func (RelPath) Dir

func (p RelPath) Dir() RelPath

Dir returns p's directory.

func (RelPath) Empty added in v2.7.5

func (p RelPath) Empty() bool

Empty returns if p is empty.

func (RelPath) Ext added in v2.0.14

func (p RelPath) Ext() string

Ext returns p's extension.

func (RelPath) HasDirPrefix

func (p RelPath) HasDirPrefix(dirPrefix RelPath) bool

HasDirPrefix returns true if p has dir prefix dirPrefix.

func (RelPath) Join

func (p RelPath) Join(relPaths ...RelPath) RelPath

Join appends relPaths to p.

func (RelPath) JoinString added in v2.7.4

func (p RelPath) JoinString(ss ...string) RelPath

JoinString returns a new RelPath with ss appended.

func (RelPath) Len added in v2.7.4

func (p RelPath) Len() int

Len returns the length of p.

func (RelPath) Less added in v2.7.4

func (p RelPath) Less(other RelPath) bool

Less returns true if p is less than other.

func (RelPath) MarshalJSON added in v2.7.4

func (p RelPath) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding.TextMarshaler.MarshalJSON.

func (RelPath) Slice added in v2.7.4

func (p RelPath) Slice(begin, end int) RelPath

Slice returns a part of p.

func (RelPath) Split

func (p RelPath) Split() (RelPath, RelPath)

Split returns p's directory and path.

func (RelPath) SplitAll added in v2.7.5

func (p RelPath) SplitAll() []RelPath

SplitAll returns p's components.

func (RelPath) String added in v2.3.0

func (p RelPath) String() string

func (RelPath) TrimDirPrefix

func (p RelPath) TrimDirPrefix(dirPrefix RelPath) (RelPath, error)

TrimDirPrefix trims prefix from p.

type RelPaths

type RelPaths []RelPath

RelPaths is a slice of RelPaths that implements sort.Interface.

func (RelPaths) Len

func (ps RelPaths) Len() int

func (RelPaths) Less

func (ps RelPaths) Less(i, j int) bool

func (RelPaths) Swap

func (ps RelPaths) Swap(i, j int)

type ScriptCondition added in v2.7.0

type ScriptCondition string

A ScriptCondition defines under what conditions a script should be executed.

const (
	ScriptConditionAlways   ScriptCondition = ""
	ScriptConditionOnce     ScriptCondition = "once"
	ScriptConditionOnChange ScriptCondition = "onchange"
)

Script conditions.

type ScriptOrder added in v2.7.0

type ScriptOrder int

A ScriptOrder defines when a script should be executed.

const (
	ScriptOrderBefore ScriptOrder = -1
	ScriptOrderDuring ScriptOrder = 0
	ScriptOrderAfter  ScriptOrder = 1
)

Script orders.

type SourceFileTargetType

type SourceFileTargetType int

A SourceFileTargetType is a the type of a target represented by a file in the source state. A file in the source state can represent a file, script, or symlink in the target state.

const (
	SourceFileTypeCreate SourceFileTargetType = iota
	SourceFileTypeFile
	SourceFileTypeModify
	SourceFileTypeRemove
	SourceFileTypeScript
	SourceFileTypeSymlink
)

Source file types.

type SourceRelPath

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

A SourceRelPath is a relative path to an entry in the source state.

func NewSourceRelDirPath

func NewSourceRelDirPath(relPath string) SourceRelPath

NewSourceRelDirPath returns a new SourceRelPath for a directory.

func NewSourceRelPath

func NewSourceRelPath(relPath string) SourceRelPath

NewSourceRelPath returns a new SourceRelPath.

func (SourceRelPath) Dir

func (p SourceRelPath) Dir() SourceRelPath

Dir returns p's directory.

func (SourceRelPath) Empty

func (p SourceRelPath) Empty() bool

Empty returns true if p is empty.

func (SourceRelPath) Join

func (p SourceRelPath) Join(sourceRelPaths ...SourceRelPath) SourceRelPath

Join appends sourceRelPaths to p.

func (SourceRelPath) Less added in v2.7.4

func (p SourceRelPath) Less(other SourceRelPath) bool

Less returns true if p is less than other.

func (SourceRelPath) RelPath

func (p SourceRelPath) RelPath() RelPath

RelPath returns p as a relative path.

func (SourceRelPath) Split

Split returns the p's file and directory.

func (SourceRelPath) String

func (p SourceRelPath) String() string

func (SourceRelPath) TargetRelPath

func (p SourceRelPath) TargetRelPath(encryptedSuffix string) RelPath

TargetRelPath returns the relative path of p's target.

type SourceState

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

A SourceState is a source state.

func NewSourceState

func NewSourceState(options ...SourceStateOption) *SourceState

NewSourceState creates a new source state with the given options.

func (*SourceState) Add

func (s *SourceState) Add(
	sourceSystem System, persistentState PersistentState, destSystem System, destAbsPathInfos map[AbsPath]fs.FileInfo,
	options *AddOptions,
) error

Add adds destAbsPathInfos to s.

func (*SourceState) AddDestAbsPathInfos

func (s *SourceState) AddDestAbsPathInfos(
	destAbsPathInfos map[AbsPath]fs.FileInfo, system System, destAbsPath AbsPath, fileInfo fs.FileInfo,
) error

AddDestAbsPathInfos adds an fs.FileInfo to destAbsPathInfos for destAbsPath and any of its parents which are not already known.

func (*SourceState) Apply

func (s *SourceState) Apply(
	targetSystem, destSystem System, persistentState PersistentState, targetDir AbsPath, targetRelPath RelPath,
	options ApplyOptions,
) error

Apply updates targetRelPath in targetDir in destSystem to match s.

func (*SourceState) Contains added in v2.7.5

func (s *SourceState) Contains(targetRelPath RelPath) bool

Contains returns the source state entry for targetRelPath.

func (*SourceState) Encryption

func (s *SourceState) Encryption() Encryption

Encryption returns s's encryption.

func (*SourceState) ExecuteTemplateData

func (s *SourceState) ExecuteTemplateData(name string, data []byte) ([]byte, error)

ExecuteTemplateData returns the result of executing template data.

func (*SourceState) ForEach added in v2.7.5

func (s *SourceState) ForEach(f func(RelPath, SourceStateEntry) error) error

ForEach calls f for each source state entry.

func (*SourceState) Ignore added in v2.7.2

func (s *SourceState) Ignore(targetRelPath RelPath) bool

Ignore returns if targetRelPath should be ignored.

func (*SourceState) MustEntry

func (s *SourceState) MustEntry(targetRelPath RelPath) SourceStateEntry

MustEntry returns the source state entry associated with targetRelPath, and panics if it does not exist.

func (*SourceState) Read

func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error

Read reads the source state from the source directory.

func (*SourceState) TargetRelPaths

func (s *SourceState) TargetRelPaths() []RelPath

TargetRelPaths returns all of s's target relative paths in order.

func (*SourceState) TemplateData

func (s *SourceState) TemplateData() map[string]interface{}

TemplateData returns s's template data.

type SourceStateDir

type SourceStateDir struct {
	Attr DirAttr
	// contains filtered or unexported fields
}

A SourceStateDir represents the state of a directory in the source state.

func (*SourceStateDir) Evaluate

func (s *SourceStateDir) Evaluate() error

Evaluate evaluates s and returns any error.

func (*SourceStateDir) MarshalZerologObject added in v2.5.0

func (s *SourceStateDir) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.

func (*SourceStateDir) Order

func (s *SourceStateDir) Order() ScriptOrder

Order returns s's order.

func (*SourceStateDir) Origin added in v2.7.5

func (s *SourceStateDir) Origin() string

Origin returns s's origin.

func (*SourceStateDir) SourceRelPath

func (s *SourceStateDir) SourceRelPath() SourceRelPath

SourceRelPath returns s's source relative path.

func (*SourceStateDir) TargetStateEntry

func (s *SourceStateDir) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)

TargetStateEntry returns s's target state entry.

type SourceStateEntry

type SourceStateEntry interface {
	zerolog.LogObjectMarshaler
	Evaluate() error
	Order() ScriptOrder
	Origin() string
	SourceRelPath() SourceRelPath
	TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)
}

A SourceStateEntry represents the state of an entry in the source state.

type SourceStateFile

type SourceStateFile struct {
	Attr FileAttr
	// contains filtered or unexported fields
}

A SourceStateFile represents the state of a file in the source state.

func (SourceStateFile) Contents

func (lc SourceStateFile) Contents() ([]byte, error)

Contents returns lc's contents.

func (SourceStateFile) ContentsSHA256

func (lc SourceStateFile) ContentsSHA256() ([]byte, error)

ContentsSHA256 returns the SHA256 sum of lc's contents.

func (*SourceStateFile) Evaluate

func (s *SourceStateFile) Evaluate() error

Evaluate evaluates s and returns any error.

func (*SourceStateFile) MarshalZerologObject added in v2.5.0

func (s *SourceStateFile) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.

func (*SourceStateFile) Order

func (s *SourceStateFile) Order() ScriptOrder

Order returns s's order.

func (*SourceStateFile) Origin added in v2.7.5

func (s *SourceStateFile) Origin() string

Origin returns s's origin.

func (*SourceStateFile) SourceRelPath

func (s *SourceStateFile) SourceRelPath() SourceRelPath

SourceRelPath returns s's source relative path.

func (*SourceStateFile) TargetStateEntry

func (s *SourceStateFile) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)

TargetStateEntry returns s's target state entry.

type SourceStateOption

type SourceStateOption func(*SourceState)

A SourceStateOption sets an option on a source state.

func WithBaseSystem added in v2.2.0

func WithBaseSystem(baseSystem System) SourceStateOption

WithBaseSystem sets the base system.

func WithCacheDir added in v2.2.0

func WithCacheDir(cacheDirAbsPath AbsPath) SourceStateOption

WithCacheDir sets the cache directory.

func WithDefaultTemplateDataFunc

func WithDefaultTemplateDataFunc(defaultTemplateDataFunc func() map[string]interface{}) SourceStateOption

WithDefaultTemplateDataFunc sets the default template data function.

func WithDestDir

func WithDestDir(destDirAbsPath AbsPath) SourceStateOption

WithDestDir sets the destination directory.

func WithEncryption

func WithEncryption(encryption Encryption) SourceStateOption

WithEncryption sets the encryption.

func WithHTTPClient added in v2.8.0

func WithHTTPClient(httpClient *http.Client) SourceStateOption

WithHTTPClient sets the HTTP client.

func WithInterpreters added in v2.0.14

func WithInterpreters(interpreters map[string]*Interpreter) SourceStateOption

WithInterpreters sets the interpreters.

func WithLogger added in v2.7.0

func WithLogger(logger *zerolog.Logger) SourceStateOption

WithLogger sets the logger.

func WithMode added in v2.1.5

func WithMode(mode Mode) SourceStateOption

WithMode sets the mode.

func WithPriorityTemplateData

func WithPriorityTemplateData(priorityTemplateData map[string]interface{}) SourceStateOption

WithPriorityTemplateData adds priority template data.

func WithReadTemplateData added in v2.1.5

func WithReadTemplateData(readTemplateData bool) SourceStateOption

WithReadTemplateData sets whether to read .chezmoidata.<format> files.

func WithSourceDir

func WithSourceDir(sourceDirAbsPath AbsPath) SourceStateOption

WithSourceDir sets the source directory.

func WithSystem

func WithSystem(system System) SourceStateOption

WithSystem sets the system.

func WithTemplateDataOnly added in v2.10.1

func WithTemplateDataOnly(templateDataOnly bool) SourceStateOption

WithTemplateDataOnly sets whether only template data should be read.

func WithTemplateFuncs

func WithTemplateFuncs(templateFuncs template.FuncMap) SourceStateOption

WithTemplateFuncs sets the template functions.

func WithTemplateOptions

func WithTemplateOptions(templateOptions []string) SourceStateOption

WithTemplateOptions sets the template options.

func WithVersion added in v2.9.2

func WithVersion(version semver.Version) SourceStateOption

WithVersion sets the version.

type SourceStateRemove

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

A SourceStateRemove represents that an entry should be removed.

func (*SourceStateRemove) Evaluate

func (s *SourceStateRemove) Evaluate() error

Evaluate evaluates s and returns any error.

func (*SourceStateRemove) MarshalZerologObject added in v2.5.0

func (s *SourceStateRemove) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog.LogObjectMarshaler.

func (*SourceStateRemove) Order

func (s *SourceStateRemove) Order() ScriptOrder

Order returns s's order.

func (*SourceStateRemove) Origin added in v2.7.5

func (s *SourceStateRemove) Origin() string

Origin returns s's origin.

func (*SourceStateRemove) SourceRelPath

func (s *SourceStateRemove) SourceRelPath() SourceRelPath

SourceRelPath returns s's source relative path.

func (*SourceStateRemove) TargetStateEntry

func (s *SourceStateRemove) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)

TargetStateEntry returns s's target state entry.

type System

type System interface {
	Chmod(name AbsPath, mode fs.FileMode) error
	Glob(pattern string) ([]string, error)
	IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
	IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
	Link(oldname, newname AbsPath) error
	Lstat(filename AbsPath) (fs.FileInfo, error)
	Mkdir(name AbsPath, perm fs.FileMode) error
	RawPath(absPath AbsPath) (AbsPath, error)
	ReadDir(name AbsPath) ([]fs.DirEntry, error)
	ReadFile(name AbsPath) ([]byte, error)
	Readlink(name AbsPath) (string, error)
	RemoveAll(name AbsPath) error
	Rename(oldpath, newpath AbsPath) error
	RunCmd(cmd *exec.Cmd) error
	RunIdempotentCmd(cmd *exec.Cmd) error
	RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
	Stat(name AbsPath) (fs.FileInfo, error)
	UnderlyingFS() vfs.FS
	WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
	WriteSymlink(oldname string, newname AbsPath) error
}

A System reads from and writes to a filesystem, executes idempotent commands, runs scripts, and persists state.

type TarWriterSystem added in v2.9.3

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

A TarWriterSystem is a System that writes to a tar archive.

func NewTarWriterSystem added in v2.9.3

func NewTarWriterSystem(w io.Writer, headerTemplate tar.Header) *TarWriterSystem

NewTarWriterSystem returns a new TarWriterSystem that writes a tar file to w.

func (TarWriterSystem) Chmod added in v2.9.3

func (TarWriterSystem) Chmod(name AbsPath, perm fs.FileMode) error

func (*TarWriterSystem) Close added in v2.9.3

func (s *TarWriterSystem) Close() error

Close closes m.

func (TarWriterSystem) Glob added in v2.9.3

func (TarWriterSystem) Glob(pattern string) ([]string, error)

func (TarWriterSystem) IdempotentCmdCombinedOutput added in v2.9.3

func (TarWriterSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

func (TarWriterSystem) IdempotentCmdOutput added in v2.9.3

func (TarWriterSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
func (TarWriterSystem) Link(oldname, newname AbsPath) error

func (TarWriterSystem) Lstat added in v2.9.3

func (TarWriterSystem) Lstat(name AbsPath) (fs.FileInfo, error)

func (*TarWriterSystem) Mkdir added in v2.9.3

func (s *TarWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (TarWriterSystem) RawPath added in v2.9.3

func (TarWriterSystem) RawPath(path AbsPath) (AbsPath, error)

func (TarWriterSystem) ReadDir added in v2.9.3

func (TarWriterSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

func (TarWriterSystem) ReadFile added in v2.9.3

func (TarWriterSystem) ReadFile(name AbsPath) ([]byte, error)
func (TarWriterSystem) Readlink(name AbsPath) (string, error)

func (TarWriterSystem) RemoveAll added in v2.9.3

func (TarWriterSystem) RemoveAll(name AbsPath) error

func (TarWriterSystem) Rename added in v2.9.3

func (TarWriterSystem) Rename(oldpath, newpath AbsPath) error

func (TarWriterSystem) RunCmd added in v2.9.3

func (TarWriterSystem) RunCmd(cmd *exec.Cmd) error

func (TarWriterSystem) RunIdempotentCmd added in v2.9.3

func (TarWriterSystem) RunIdempotentCmd(cmd *exec.Cmd) error

func (*TarWriterSystem) RunScript added in v2.9.3

func (s *TarWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (TarWriterSystem) Stat added in v2.9.3

func (TarWriterSystem) Stat(name AbsPath) (fs.FileInfo, error)

func (TarWriterSystem) UnderlyingFS added in v2.9.3

func (TarWriterSystem) UnderlyingFS() vfs.FS

func (*TarWriterSystem) WriteFile added in v2.9.3

func (s *TarWriterSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *TarWriterSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

type TargetStateDir

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

A TargetStateDir represents the state of a directory in the target state.

func (*TargetStateDir) Apply

func (t *TargetStateDir) Apply(
	system System, persistentState PersistentState, actualStateEntry ActualStateEntry,
) (bool, error)

Apply updates actualStateEntry to match t. It does not recurse.

func (*TargetStateDir) EntryState

func (t *TargetStateDir) EntryState(umask fs.FileMode) (*EntryState, error)

EntryState returns t's entry state.

func (*TargetStateDir) Evaluate

func (t *TargetStateDir) Evaluate() error

Evaluate evaluates t.

func (*TargetStateDir) SkipApply

func (t *TargetStateDir) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)

SkipApply implements TargetState.SkipApply.

type TargetStateEntry

type TargetStateEntry interface {
	Apply(system System, persistentState PersistentState, actualStateEntry ActualStateEntry) (bool, error)
	EntryState(umask fs.FileMode) (*EntryState, error)
	Evaluate() error
	SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
}

A TargetStateEntry represents the state of an entry in the target state.

type TargetStateFile

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

A TargetStateFile represents the state of a file in the target state.

func (*TargetStateFile) Apply

func (t *TargetStateFile) Apply(
	system System, persistentState PersistentState, actualStateEntry ActualStateEntry,
) (bool, error)

Apply updates actualStateEntry to match t.

func (TargetStateFile) Contents

func (lc TargetStateFile) Contents() ([]byte, error)

Contents returns lc's contents.

func (TargetStateFile) ContentsSHA256

func (lc TargetStateFile) ContentsSHA256() ([]byte, error)

ContentsSHA256 returns the SHA256 sum of lc's contents.

func (*TargetStateFile) EntryState

func (t *TargetStateFile) EntryState(umask fs.FileMode) (*EntryState, error)

EntryState returns t's entry state.

func (*TargetStateFile) Evaluate

func (t *TargetStateFile) Evaluate() error

Evaluate evaluates t.

func (*TargetStateFile) Perm added in v2.0.13

func (t *TargetStateFile) Perm(umask fs.FileMode) fs.FileMode

Perm returns t's perm.

func (*TargetStateFile) SkipApply

func (t *TargetStateFile) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)

SkipApply implements TargetState.SkipApply.

type TargetStateRemove

type TargetStateRemove struct{}

A TargetStateRemove represents the absence of an entry in the target state.

func (*TargetStateRemove) Apply

func (t *TargetStateRemove) Apply(
	system System, persistentState PersistentState, actualStateEntry ActualStateEntry,
) (bool, error)

Apply updates actualStateEntry to match t.

func (*TargetStateRemove) EntryState

func (t *TargetStateRemove) EntryState(umask fs.FileMode) (*EntryState, error)

EntryState returns t's entry state.

func (*TargetStateRemove) Evaluate

func (t *TargetStateRemove) Evaluate() error

Evaluate evaluates t.

func (*TargetStateRemove) SkipApply

func (t *TargetStateRemove) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)

SkipApply implements TargetState.SkipApply.

type TargetStateScript

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

A TargetStateScript represents the state of a script.

func (*TargetStateScript) Apply

func (t *TargetStateScript) Apply(
	system System, persistentState PersistentState, actualStateEntry ActualStateEntry,
) (bool, error)

Apply runs t.

func (TargetStateScript) Contents

func (lc TargetStateScript) Contents() ([]byte, error)

Contents returns lc's contents.

func (TargetStateScript) ContentsSHA256

func (lc TargetStateScript) ContentsSHA256() ([]byte, error)

ContentsSHA256 returns the SHA256 sum of lc's contents.

func (*TargetStateScript) EntryState

func (t *TargetStateScript) EntryState(umask fs.FileMode) (*EntryState, error)

EntryState returns t's entry state.

func (*TargetStateScript) Evaluate

func (t *TargetStateScript) Evaluate() error

Evaluate evaluates t.

func (*TargetStateScript) SkipApply

func (t *TargetStateScript) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)

SkipApply implements TargetState.SkipApply.

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

A TargetStateSymlink represents the state of a symlink in the target state.

func (*TargetStateSymlink) Apply

func (t *TargetStateSymlink) Apply(
	system System, persistentState PersistentState, actualStateEntry ActualStateEntry,
) (bool, error)

Apply updates actualStateEntry to match t.

func (*TargetStateSymlink) EntryState

func (t *TargetStateSymlink) EntryState(umask fs.FileMode) (*EntryState, error)

EntryState returns t's entry state.

func (*TargetStateSymlink) Evaluate

func (t *TargetStateSymlink) Evaluate() error

Evaluate evaluates t.

func (TargetStateSymlink) Linkname

func (ll TargetStateSymlink) Linkname() (string, error)

Linkname returns s's linkname.

func (TargetStateSymlink) LinknameSHA256

func (ll TargetStateSymlink) LinknameSHA256() ([]byte, error)

LinknameSHA256 returns the SHA256 sum of ll's linkname.

func (*TargetStateSymlink) SkipApply

func (t *TargetStateSymlink) SkipApply(
	persistentState PersistentState, targetAbsPath AbsPath,
) (bool, error)

SkipApply implements TargetState.SkipApply.

type TooOldError added in v2.9.2

type TooOldError struct {
	Have semver.Version
	Need semver.Version
}

A TooOldErrror is returned when the source state requires a newer version of chezmoi.

func (*TooOldError) Error added in v2.9.2

func (e *TooOldError) Error() string

type WalkArchiveFunc added in v2.9.1

type WalkArchiveFunc func(name string, info fs.FileInfo, r io.Reader, linkname string) error

An WalkArchiveFunc is called once for each entry in an archive.

type WalkFunc added in v2.8.0

type WalkFunc func(absPath AbsPath, fileInfo fs.FileInfo, err error) error

A WalkFunc is called for every entry in a directory.

type WalkSourceDirFunc added in v2.8.0

type WalkSourceDirFunc func(absPath AbsPath, fileInfo fs.FileInfo, err error) error

A WalkSourceDirFunc is a function called for every entry in a source directory.

type ZIPWriterSystem

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

A ZIPWriterSystem is a System that writes to a ZIP archive.

func NewZIPWriterSystem

func NewZIPWriterSystem(w io.Writer, modified time.Time) *ZIPWriterSystem

NewZIPWriterSystem returns a new ZIPWriterSystem that writes a ZIP archive to w.

func (ZIPWriterSystem) Chmod

func (ZIPWriterSystem) Chmod(name AbsPath, perm fs.FileMode) error

func (*ZIPWriterSystem) Close

func (s *ZIPWriterSystem) Close() error

Close closes m.

func (ZIPWriterSystem) Glob

func (ZIPWriterSystem) Glob(pattern string) ([]string, error)

func (ZIPWriterSystem) IdempotentCmdCombinedOutput

func (ZIPWriterSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)

func (ZIPWriterSystem) IdempotentCmdOutput

func (ZIPWriterSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
func (ZIPWriterSystem) Link(oldname, newname AbsPath) error

func (ZIPWriterSystem) Lstat

func (ZIPWriterSystem) Lstat(name AbsPath) (fs.FileInfo, error)

func (*ZIPWriterSystem) Mkdir

func (s *ZIPWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error

Mkdir implements System.Mkdir.

func (ZIPWriterSystem) RawPath

func (ZIPWriterSystem) RawPath(path AbsPath) (AbsPath, error)

func (ZIPWriterSystem) ReadDir

func (ZIPWriterSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)

func (ZIPWriterSystem) ReadFile

func (ZIPWriterSystem) ReadFile(name AbsPath) ([]byte, error)
func (ZIPWriterSystem) Readlink(name AbsPath) (string, error)

func (ZIPWriterSystem) RemoveAll

func (ZIPWriterSystem) RemoveAll(name AbsPath) error

func (ZIPWriterSystem) Rename

func (ZIPWriterSystem) Rename(oldpath, newpath AbsPath) error

func (ZIPWriterSystem) RunCmd

func (ZIPWriterSystem) RunCmd(cmd *exec.Cmd) error

func (ZIPWriterSystem) RunIdempotentCmd added in v2.1.5

func (ZIPWriterSystem) RunIdempotentCmd(cmd *exec.Cmd) error

func (*ZIPWriterSystem) RunScript

func (s *ZIPWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error

RunScript implements System.RunScript.

func (ZIPWriterSystem) Stat

func (ZIPWriterSystem) Stat(name AbsPath) (fs.FileInfo, error)

func (ZIPWriterSystem) UnderlyingFS

func (ZIPWriterSystem) UnderlyingFS() vfs.FS

func (*ZIPWriterSystem) WriteFile

func (s *ZIPWriterSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error

WriteFile implements System.WriteFile.

func (s *ZIPWriterSystem) WriteSymlink(oldname string, newname AbsPath) error

WriteSymlink implements System.WriteSymlink.

Jump to

Keyboard shortcuts

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