Documentation ¶
Overview ¶
Package chezmoi contains chezmoi's core logic.
Index ¶
- Constants
- Variables
- func CutBytes(s, sep []byte) (before, after []byte, found bool)
- func CutString(s, sep string) (before, after string, found bool)
- func DiffPatch(path RelPath, fromData []byte, fromMode fs.FileMode, toData []byte, ...) (diff.Patch, error)
- func FQDNHostname(fileSystem vfs.FS) string
- func Kernel(fileSystem vfs.FS) (map[string]interface{}, error)
- func MkdirAll(system System, absPath AbsPath, perm fs.FileMode) error
- func OSRelease(system System) (map[string]interface{}, error)
- func PersistentStateBucketData(s PersistentState, bucket []byte) (map[string]interface{}, error)
- func PersistentStateData(s PersistentState) (interface{}, error)
- func RecursiveMerge(dest, source map[string]interface{})
- func SHA256Sum(data []byte) []byte
- func StringSliceToEntryTypeSetHookFunc() mapstructure.DecodeHookFunc
- func StringToAbsPathHookFunc() mapstructure.DecodeHookFunc
- func SuspiciousSourceDirEntry(base string, fileInfo fs.FileInfo) bool
- func Walk(system System, rootAbsPath AbsPath, walkFunc WalkFunc) error
- func WalkArchive(data []byte, format ArchiveFormat, f WalkArchiveFunc) error
- func WalkSourceDir(system System, sourceDirAbsPath AbsPath, walkFunc WalkSourceDirFunc) error
- type AbsPath
- func (p AbsPath) Append(s string) AbsPath
- func (p AbsPath) Base() string
- func (p AbsPath) Bytes() []byte
- func (p AbsPath) Dir() AbsPath
- func (p AbsPath) Empty() bool
- func (p AbsPath) Ext() string
- func (p AbsPath) Join(relPaths ...RelPath) AbsPath
- func (p AbsPath) JoinString(ss ...string) AbsPath
- func (p AbsPath) Len() int
- func (p AbsPath) Less(other AbsPath) bool
- func (p AbsPath) MarshalText() ([]byte, error)
- func (p AbsPath) MustTrimDirPrefix(dirPrefix AbsPath) RelPath
- func (p *AbsPath) Set(s string) error
- func (p AbsPath) Split() (AbsPath, RelPath)
- func (p AbsPath) String() string
- func (p AbsPath) ToSlash() AbsPath
- func (p AbsPath) TrimDirPrefix(dirPrefixAbsPath AbsPath) (RelPath, error)
- func (p AbsPath) Type() string
- func (p *AbsPath) UnmarshalText(text []byte) error
- type AbsPaths
- type ActualStateAbsent
- type ActualStateDir
- type ActualStateEntry
- type ActualStateFile
- func (lc ActualStateFile) Contents() ([]byte, error)
- func (lc ActualStateFile) ContentsSHA256() ([]byte, error)
- func (s *ActualStateFile) EntryState() (*EntryState, error)
- func (s *ActualStateFile) Path() AbsPath
- func (s *ActualStateFile) Perm() fs.FileMode
- func (s *ActualStateFile) Remove(system System) error
- type ActualStateSymlink
- type AddOptions
- type AgeEncryption
- func (e *AgeEncryption) Decrypt(ciphertext []byte) ([]byte, error)
- func (e *AgeEncryption) DecryptToFile(plaintextAbsPath AbsPath, ciphertext []byte) error
- func (e *AgeEncryption) Encrypt(plaintext []byte) ([]byte, error)
- func (e *AgeEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error)
- func (e *AgeEncryption) EncryptedSuffix() string
- type ApplyOptions
- type ArchiveFormat
- type ArchiveReaderSystem
- func (ArchiveReaderSystem) Chmod(name AbsPath, perm fs.FileMode) error
- func (s *ArchiveReaderSystem) FileInfos() map[AbsPath]fs.FileInfo
- func (ArchiveReaderSystem) Glob(pattern string) ([]string, error)
- func (ArchiveReaderSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (ArchiveReaderSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (ArchiveReaderSystem) Link(oldname, newname AbsPath) error
- func (s *ArchiveReaderSystem) Lstat(filename AbsPath) (fs.FileInfo, error)
- func (ArchiveReaderSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (ArchiveReaderSystem) RawPath(path AbsPath) (AbsPath, error)
- func (ArchiveReaderSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *ArchiveReaderSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *ArchiveReaderSystem) Readlink(name AbsPath) (string, error)
- func (ArchiveReaderSystem) RemoveAll(name AbsPath) error
- func (ArchiveReaderSystem) Rename(oldpath, newpath AbsPath) error
- func (ArchiveReaderSystem) RunCmd(cmd *exec.Cmd) error
- func (ArchiveReaderSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (ArchiveReaderSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (ArchiveReaderSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (ArchiveReaderSystem) UnderlyingFS() vfs.FS
- func (ArchiveReaderSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (ArchiveReaderSystem) WriteSymlink(oldname string, newname AbsPath) error
- type ArchiveReaderSystemOptions
- type BoltPersistentState
- func (b *BoltPersistentState) Close() error
- func (b *BoltPersistentState) CopyTo(p PersistentState) error
- func (b *BoltPersistentState) Data() (interface{}, error)
- func (b *BoltPersistentState) Delete(bucket, key []byte) error
- func (b *BoltPersistentState) DeleteBucket(bucket []byte) error
- func (b *BoltPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error
- func (b *BoltPersistentState) Get(bucket, key []byte) ([]byte, error)
- func (b *BoltPersistentState) Set(bucket, key, value []byte) error
- type BoltPersistentStateMode
- type DebugEncryption
- func (e *DebugEncryption) Decrypt(ciphertext []byte) ([]byte, error)
- func (e *DebugEncryption) DecryptToFile(plaintextAbsPath AbsPath, ciphertext []byte) error
- func (e *DebugEncryption) Encrypt(plaintext []byte) ([]byte, error)
- func (e *DebugEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error)
- func (e *DebugEncryption) EncryptedSuffix() string
- type DebugPersistentState
- func (s *DebugPersistentState) Close() error
- func (s *DebugPersistentState) CopyTo(p PersistentState) error
- func (s *DebugPersistentState) Data() (interface{}, error)
- func (s *DebugPersistentState) Delete(bucket, key []byte) error
- func (s *DebugPersistentState) DeleteBucket(bucket []byte) error
- func (s *DebugPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error
- func (s *DebugPersistentState) Get(bucket, key []byte) ([]byte, error)
- func (s *DebugPersistentState) Set(bucket, key, value []byte) error
- type DebugSystem
- func (s *DebugSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *DebugSystem) Glob(name string) ([]string, error)
- func (s *DebugSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *DebugSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *DebugSystem) Link(oldpath, newpath AbsPath) error
- func (s *DebugSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *DebugSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *DebugSystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *DebugSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *DebugSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *DebugSystem) Readlink(name AbsPath) (string, error)
- func (s *DebugSystem) RemoveAll(name AbsPath) error
- func (s *DebugSystem) Rename(oldpath, newpath AbsPath) error
- func (s *DebugSystem) RunCmd(cmd *exec.Cmd) error
- func (s *DebugSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *DebugSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *DebugSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *DebugSystem) UnderlyingFS() vfs.FS
- func (s *DebugSystem) WriteFile(name AbsPath, data []byte, perm fs.FileMode) error
- func (s *DebugSystem) WriteSymlink(oldname string, newname AbsPath) error
- type DirAttr
- type DryRunSystem
- func (s *DryRunSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *DryRunSystem) Glob(pattern string) ([]string, error)
- func (s *DryRunSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *DryRunSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *DryRunSystem) Link(oldname, newname AbsPath) error
- func (s *DryRunSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *DryRunSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *DryRunSystem) Modified() bool
- func (s *DryRunSystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *DryRunSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *DryRunSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *DryRunSystem) Readlink(name AbsPath) (string, error)
- func (s *DryRunSystem) RemoveAll(AbsPath) error
- func (s *DryRunSystem) Rename(oldpath, newpath AbsPath) error
- func (s *DryRunSystem) RunCmd(cmd *exec.Cmd) error
- func (s *DryRunSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *DryRunSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *DryRunSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *DryRunSystem) UnderlyingFS() vfs.FS
- func (s *DryRunSystem) WriteFile(AbsPath, []byte, fs.FileMode) error
- func (s *DryRunSystem) WriteSymlink(string, AbsPath) error
- type DumpSystem
- func (DumpSystem) Chmod(name AbsPath, perm fs.FileMode) error
- func (s *DumpSystem) Data() interface{}
- func (DumpSystem) Glob(pattern string) ([]string, error)
- func (DumpSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (DumpSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (DumpSystem) Link(oldname, newname AbsPath) error
- func (DumpSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *DumpSystem) Mkdir(dirname AbsPath, perm fs.FileMode) error
- func (DumpSystem) RawPath(path AbsPath) (AbsPath, error)
- func (DumpSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (DumpSystem) ReadFile(name AbsPath) ([]byte, error)
- func (DumpSystem) Readlink(name AbsPath) (string, error)
- func (DumpSystem) RemoveAll(name AbsPath) error
- func (DumpSystem) Rename(oldpath, newpath AbsPath) error
- func (DumpSystem) RunCmd(cmd *exec.Cmd) error
- func (DumpSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *DumpSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (DumpSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *DumpSystem) UnderlyingFS() vfs.FS
- func (s *DumpSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (s *DumpSystem) WriteSymlink(oldname string, newname AbsPath) error
- type Encryption
- type EntryState
- type EntryStateType
- type EntryTypeBits
- type EntryTypeSet
- func (s *EntryTypeSet) Include(b EntryTypeBits) bool
- func (s *EntryTypeSet) IncludeEncrypted() bool
- func (s *EntryTypeSet) IncludeFileInfo(fileInfo fs.FileInfo) bool
- func (s *EntryTypeSet) IncludeTargetStateEntry(targetStateEntry TargetStateEntry) bool
- func (s *EntryTypeSet) Set(str string) error
- func (s *EntryTypeSet) SetSlice(ss []string) error
- func (s *EntryTypeSet) String() string
- func (s *EntryTypeSet) Sub(other *EntryTypeSet) *EntryTypeSet
- func (s *EntryTypeSet) Type() string
- type ErrorOnWriteSystem
- func (s *ErrorOnWriteSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *ErrorOnWriteSystem) Glob(pattern string) ([]string, error)
- func (s *ErrorOnWriteSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *ErrorOnWriteSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *ErrorOnWriteSystem) Link(oldname, newname AbsPath) error
- func (s *ErrorOnWriteSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *ErrorOnWriteSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *ErrorOnWriteSystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *ErrorOnWriteSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *ErrorOnWriteSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *ErrorOnWriteSystem) Readlink(name AbsPath) (string, error)
- func (s *ErrorOnWriteSystem) RemoveAll(AbsPath) error
- func (s *ErrorOnWriteSystem) Rename(oldpath, newpath AbsPath) error
- func (s *ErrorOnWriteSystem) RunCmd(cmd *exec.Cmd) error
- func (s *ErrorOnWriteSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *ErrorOnWriteSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *ErrorOnWriteSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *ErrorOnWriteSystem) UnderlyingFS() vfs.FS
- func (s *ErrorOnWriteSystem) WriteFile(AbsPath, []byte, fs.FileMode) error
- func (s *ErrorOnWriteSystem) WriteSymlink(string, AbsPath) error
- type ExitCodeError
- type External
- type ExternalDiffSystem
- func (s *ExternalDiffSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *ExternalDiffSystem) Close() error
- func (s *ExternalDiffSystem) Glob(pattern string) ([]string, error)
- func (s *ExternalDiffSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *ExternalDiffSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *ExternalDiffSystem) Link(oldname, newname AbsPath) error
- func (s *ExternalDiffSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *ExternalDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *ExternalDiffSystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *ExternalDiffSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *ExternalDiffSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *ExternalDiffSystem) Readlink(name AbsPath) (string, error)
- func (s *ExternalDiffSystem) RemoveAll(name AbsPath) error
- func (s *ExternalDiffSystem) Rename(oldpath, newpath AbsPath) error
- func (s *ExternalDiffSystem) RunCmd(cmd *exec.Cmd) error
- func (s *ExternalDiffSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *ExternalDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *ExternalDiffSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *ExternalDiffSystem) UnderlyingFS() vfs.FS
- func (s *ExternalDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (s *ExternalDiffSystem) WriteSymlink(oldname string, newname AbsPath) error
- type ExternalDiffSystemOptions
- type ExternalType
- type FileAttr
- type Format
- type GPGEncryption
- func (e *GPGEncryption) Decrypt(ciphertext []byte) ([]byte, error)
- func (e *GPGEncryption) DecryptToFile(plaintextFilename AbsPath, ciphertext []byte) error
- func (e *GPGEncryption) Encrypt(plaintext []byte) ([]byte, error)
- func (e *GPGEncryption) EncryptFile(plaintextFilename AbsPath) ([]byte, error)
- func (e *GPGEncryption) EncryptedSuffix() string
- type GitDiffSystem
- func (s *GitDiffSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *GitDiffSystem) Glob(pattern string) ([]string, error)
- func (s *GitDiffSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *GitDiffSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *GitDiffSystem) Link(oldname, newname AbsPath) error
- func (s *GitDiffSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *GitDiffSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *GitDiffSystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *GitDiffSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *GitDiffSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *GitDiffSystem) Readlink(name AbsPath) (string, error)
- func (s *GitDiffSystem) RemoveAll(name AbsPath) error
- func (s *GitDiffSystem) Rename(oldpath, newpath AbsPath) error
- func (s *GitDiffSystem) RunCmd(cmd *exec.Cmd) error
- func (s *GitDiffSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *GitDiffSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *GitDiffSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *GitDiffSystem) UnderlyingFS() vfs.FS
- func (s *GitDiffSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (s *GitDiffSystem) WriteSymlink(oldname string, newname AbsPath) error
- type GitDiffSystemOptions
- type HexBytes
- type Interpreter
- type InvalidArchiveFormatError
- type MockPersistentState
- func (s *MockPersistentState) Close() error
- func (s *MockPersistentState) CopyTo(p PersistentState) error
- func (s *MockPersistentState) Data() (interface{}, error)
- func (s *MockPersistentState) Delete(bucket, key []byte) error
- func (s *MockPersistentState) DeleteBucket(bucket []byte) error
- func (s *MockPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error
- func (s *MockPersistentState) Get(bucket, key []byte) ([]byte, error)
- func (s *MockPersistentState) Set(bucket, key, value []byte) error
- type Mode
- type NoEncryption
- type NullPersistentState
- func (NullPersistentState) Close() error
- func (NullPersistentState) CopyTo(s PersistentState) error
- func (NullPersistentState) Data() (interface{}, error)
- func (NullPersistentState) Delete(bucket, key []byte) error
- func (NullPersistentState) DeleteBucket(bucket []byte) error
- func (NullPersistentState) ForEach(bucket []byte, fn func(k, v []byte) error) error
- func (NullPersistentState) Get(bucket, key []byte) ([]byte, error)
- func (NullPersistentState) Set(bucket, key, value []byte) error
- type PersistentState
- type PreAddFunc
- type PreApplyFunc
- type ReadOnlySystem
- func (ReadOnlySystem) Chmod(name AbsPath, perm fs.FileMode) error
- func (s *ReadOnlySystem) Glob(pattern string) ([]string, error)
- func (s *ReadOnlySystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *ReadOnlySystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (ReadOnlySystem) Link(oldname, newname AbsPath) error
- func (s *ReadOnlySystem) Lstat(filename AbsPath) (fs.FileInfo, error)
- func (ReadOnlySystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *ReadOnlySystem) RawPath(path AbsPath) (AbsPath, error)
- func (s *ReadOnlySystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *ReadOnlySystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *ReadOnlySystem) Readlink(name AbsPath) (string, error)
- func (ReadOnlySystem) RemoveAll(name AbsPath) error
- func (ReadOnlySystem) Rename(oldpath, newpath AbsPath) error
- func (ReadOnlySystem) RunCmd(cmd *exec.Cmd) error
- func (s *ReadOnlySystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (ReadOnlySystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (s *ReadOnlySystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *ReadOnlySystem) UnderlyingFS() vfs.FS
- func (ReadOnlySystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (ReadOnlySystem) WriteSymlink(oldname string, newname AbsPath) error
- type ReadOptions
- type RealSystem
- func (s *RealSystem) Chmod(name AbsPath, mode fs.FileMode) error
- func (s *RealSystem) Glob(pattern string) ([]string, error)
- func (s *RealSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *RealSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (s *RealSystem) Link(oldname, newname AbsPath) error
- func (s *RealSystem) Lstat(filename AbsPath) (fs.FileInfo, error)
- func (s *RealSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (s *RealSystem) RawPath(absPath AbsPath) (AbsPath, error)
- func (s *RealSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (s *RealSystem) ReadFile(name AbsPath) ([]byte, error)
- func (s *RealSystem) Readlink(name AbsPath) (string, error)
- func (s *RealSystem) RemoveAll(name AbsPath) error
- func (s *RealSystem) Rename(oldpath, newpath AbsPath) error
- func (s *RealSystem) RunCmd(cmd *exec.Cmd) error
- func (s *RealSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *RealSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) (err error)
- func (s *RealSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (s *RealSystem) UnderlyingFS() vfs.FS
- func (s *RealSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) (err error)
- func (s *RealSystem) WriteSymlink(oldname string, newname AbsPath) error
- type RealSystemOption
- type RelPath
- func (p RelPath) AppendString(s string) RelPath
- func (p RelPath) Base() string
- func (p RelPath) Dir() RelPath
- func (p RelPath) Empty() bool
- func (p RelPath) Ext() string
- func (p RelPath) HasDirPrefix(dirPrefix RelPath) bool
- func (p RelPath) Join(relPaths ...RelPath) RelPath
- func (p RelPath) JoinString(ss ...string) RelPath
- func (p RelPath) Len() int
- func (p RelPath) Less(other RelPath) bool
- func (p RelPath) MarshalJSON() ([]byte, error)
- func (p RelPath) Slice(begin, end int) RelPath
- func (p RelPath) Split() (RelPath, RelPath)
- func (p RelPath) SplitAll() []RelPath
- func (p RelPath) String() string
- func (p RelPath) TrimDirPrefix(dirPrefix RelPath) (RelPath, error)
- type RelPaths
- type ScriptCondition
- type ScriptOrder
- type SourceFileTargetType
- type SourceRelPath
- func (p SourceRelPath) Dir() SourceRelPath
- func (p SourceRelPath) Empty() bool
- func (p SourceRelPath) Join(sourceRelPaths ...SourceRelPath) SourceRelPath
- func (p SourceRelPath) Less(other SourceRelPath) bool
- func (p SourceRelPath) RelPath() RelPath
- func (p SourceRelPath) Split() (SourceRelPath, SourceRelPath)
- func (p SourceRelPath) String() string
- func (p SourceRelPath) TargetRelPath(encryptedSuffix string) RelPath
- type SourceState
- func (s *SourceState) Add(sourceSystem System, persistentState PersistentState, destSystem System, ...) error
- func (s *SourceState) AddDestAbsPathInfos(destAbsPathInfos map[AbsPath]fs.FileInfo, system System, destAbsPath AbsPath, ...) error
- func (s *SourceState) Apply(targetSystem, destSystem System, persistentState PersistentState, ...) error
- func (s *SourceState) Contains(targetRelPath RelPath) bool
- func (s *SourceState) Encryption() Encryption
- func (s *SourceState) ExecuteTemplateData(name string, data []byte) ([]byte, error)
- func (s *SourceState) ForEach(f func(RelPath, SourceStateEntry) error) error
- func (s *SourceState) Ignore(targetRelPath RelPath) bool
- func (s *SourceState) MustEntry(targetRelPath RelPath) SourceStateEntry
- func (s *SourceState) Read(ctx context.Context, options *ReadOptions) error
- func (s *SourceState) TargetRelPaths() []RelPath
- func (s *SourceState) TemplateData() map[string]interface{}
- type SourceStateDir
- func (s *SourceStateDir) Evaluate() error
- func (s *SourceStateDir) MarshalZerologObject(e *zerolog.Event)
- func (s *SourceStateDir) Order() ScriptOrder
- func (s *SourceStateDir) Origin() string
- func (s *SourceStateDir) SourceRelPath() SourceRelPath
- func (s *SourceStateDir) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)
- type SourceStateEntry
- type SourceStateFile
- func (lc SourceStateFile) Contents() ([]byte, error)
- func (lc SourceStateFile) ContentsSHA256() ([]byte, error)
- func (s *SourceStateFile) Evaluate() error
- func (s *SourceStateFile) MarshalZerologObject(e *zerolog.Event)
- func (s *SourceStateFile) Order() ScriptOrder
- func (s *SourceStateFile) Origin() string
- func (s *SourceStateFile) SourceRelPath() SourceRelPath
- func (s *SourceStateFile) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)
- type SourceStateOption
- func WithBaseSystem(baseSystem System) SourceStateOption
- func WithCacheDir(cacheDirAbsPath AbsPath) SourceStateOption
- func WithDefaultTemplateDataFunc(defaultTemplateDataFunc func() map[string]interface{}) SourceStateOption
- func WithDestDir(destDirAbsPath AbsPath) SourceStateOption
- func WithEncryption(encryption Encryption) SourceStateOption
- func WithHTTPClient(httpClient *http.Client) SourceStateOption
- func WithInterpreters(interpreters map[string]*Interpreter) SourceStateOption
- func WithLogger(logger *zerolog.Logger) SourceStateOption
- func WithMode(mode Mode) SourceStateOption
- func WithPriorityTemplateData(priorityTemplateData map[string]interface{}) SourceStateOption
- func WithReadTemplateData(readTemplateData bool) SourceStateOption
- func WithSourceDir(sourceDirAbsPath AbsPath) SourceStateOption
- func WithSystem(system System) SourceStateOption
- func WithTemplateDataOnly(templateDataOnly bool) SourceStateOption
- func WithTemplateFuncs(templateFuncs template.FuncMap) SourceStateOption
- func WithTemplateOptions(templateOptions []string) SourceStateOption
- func WithVersion(version semver.Version) SourceStateOption
- type SourceStateRemove
- func (s *SourceStateRemove) Evaluate() error
- func (s *SourceStateRemove) MarshalZerologObject(e *zerolog.Event)
- func (s *SourceStateRemove) Order() ScriptOrder
- func (s *SourceStateRemove) Origin() string
- func (s *SourceStateRemove) SourceRelPath() SourceRelPath
- func (s *SourceStateRemove) TargetStateEntry(destSystem System, destDirAbsPath AbsPath) (TargetStateEntry, error)
- type System
- type TarWriterSystem
- func (TarWriterSystem) Chmod(name AbsPath, perm fs.FileMode) error
- func (s *TarWriterSystem) Close() error
- func (TarWriterSystem) Glob(pattern string) ([]string, error)
- func (TarWriterSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (TarWriterSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (TarWriterSystem) Link(oldname, newname AbsPath) error
- func (TarWriterSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *TarWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (TarWriterSystem) RawPath(path AbsPath) (AbsPath, error)
- func (TarWriterSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (TarWriterSystem) ReadFile(name AbsPath) ([]byte, error)
- func (TarWriterSystem) Readlink(name AbsPath) (string, error)
- func (TarWriterSystem) RemoveAll(name AbsPath) error
- func (TarWriterSystem) Rename(oldpath, newpath AbsPath) error
- func (TarWriterSystem) RunCmd(cmd *exec.Cmd) error
- func (TarWriterSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *TarWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (TarWriterSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (TarWriterSystem) UnderlyingFS() vfs.FS
- func (s *TarWriterSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (s *TarWriterSystem) WriteSymlink(oldname string, newname AbsPath) error
- type TargetStateDir
- func (t *TargetStateDir) Apply(system System, persistentState PersistentState, ...) (bool, error)
- func (t *TargetStateDir) EntryState(umask fs.FileMode) (*EntryState, error)
- func (t *TargetStateDir) Evaluate() error
- func (t *TargetStateDir) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
- type TargetStateEntry
- type TargetStateFile
- func (t *TargetStateFile) Apply(system System, persistentState PersistentState, ...) (bool, error)
- func (lc TargetStateFile) Contents() ([]byte, error)
- func (lc TargetStateFile) ContentsSHA256() ([]byte, error)
- func (t *TargetStateFile) EntryState(umask fs.FileMode) (*EntryState, error)
- func (t *TargetStateFile) Evaluate() error
- func (t *TargetStateFile) Perm(umask fs.FileMode) fs.FileMode
- func (t *TargetStateFile) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
- type TargetStateRemove
- func (t *TargetStateRemove) Apply(system System, persistentState PersistentState, ...) (bool, error)
- func (t *TargetStateRemove) EntryState(umask fs.FileMode) (*EntryState, error)
- func (t *TargetStateRemove) Evaluate() error
- func (t *TargetStateRemove) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
- type TargetStateScript
- func (t *TargetStateScript) Apply(system System, persistentState PersistentState, ...) (bool, error)
- func (lc TargetStateScript) Contents() ([]byte, error)
- func (lc TargetStateScript) ContentsSHA256() ([]byte, error)
- func (t *TargetStateScript) EntryState(umask fs.FileMode) (*EntryState, error)
- func (t *TargetStateScript) Evaluate() error
- func (t *TargetStateScript) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
- type TargetStateSymlink
- func (t *TargetStateSymlink) Apply(system System, persistentState PersistentState, ...) (bool, error)
- func (t *TargetStateSymlink) EntryState(umask fs.FileMode) (*EntryState, error)
- func (t *TargetStateSymlink) Evaluate() error
- func (ll TargetStateSymlink) Linkname() (string, error)
- func (ll TargetStateSymlink) LinknameSHA256() ([]byte, error)
- func (t *TargetStateSymlink) SkipApply(persistentState PersistentState, targetAbsPath AbsPath) (bool, error)
- type TooOldError
- type WalkArchiveFunc
- type WalkFunc
- type WalkSourceDirFunc
- type ZIPWriterSystem
- func (ZIPWriterSystem) Chmod(name AbsPath, perm fs.FileMode) error
- func (s *ZIPWriterSystem) Close() error
- func (ZIPWriterSystem) Glob(pattern string) ([]string, error)
- func (ZIPWriterSystem) IdempotentCmdCombinedOutput(cmd *exec.Cmd) ([]byte, error)
- func (ZIPWriterSystem) IdempotentCmdOutput(cmd *exec.Cmd) ([]byte, error)
- func (ZIPWriterSystem) Link(oldname, newname AbsPath) error
- func (ZIPWriterSystem) Lstat(name AbsPath) (fs.FileInfo, error)
- func (s *ZIPWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error
- func (ZIPWriterSystem) RawPath(path AbsPath) (AbsPath, error)
- func (ZIPWriterSystem) ReadDir(name AbsPath) ([]fs.DirEntry, error)
- func (ZIPWriterSystem) ReadFile(name AbsPath) ([]byte, error)
- func (ZIPWriterSystem) Readlink(name AbsPath) (string, error)
- func (ZIPWriterSystem) RemoveAll(name AbsPath) error
- func (ZIPWriterSystem) Rename(oldpath, newpath AbsPath) error
- func (ZIPWriterSystem) RunCmd(cmd *exec.Cmd) error
- func (ZIPWriterSystem) RunIdempotentCmd(cmd *exec.Cmd) error
- func (s *ZIPWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
- func (ZIPWriterSystem) Stat(name AbsPath) (fs.FileInfo, error)
- func (ZIPWriterSystem) UnderlyingFS() vfs.FS
- func (s *ZIPWriterSystem) WriteFile(filename AbsPath, data []byte, perm fs.FileMode) error
- func (s *ZIPWriterSystem) WriteSymlink(oldname string, newname AbsPath) error
Constants ¶
const ( Prefix = ".chezmoi" RootName = Prefix + "root" VersionName = Prefix + "version" )
Special file names.
const (
TemplateSuffix = ".tmpl"
)
Prefixes and suffixes.
Variables ¶
var ( DotAbsPath = NewAbsPath(".") EmptyAbsPath = NewAbsPath("") RootAbsPath = NewAbsPath("/") )
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) )
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") )
var ( DotRelPath = NewRelPath(".") EmptyRelPath = NewRelPath("") )
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
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
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 ¶
FQDNHostname returns the FQDN hostname, if it can be determined.
func OSRelease ¶
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 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 ¶
SuspiciousSourceDirEntry returns true if base is a suspicious dir entry.
func Walk ¶
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
HomeDirAbsPath returns the user's home directory as an AbsPath.
func NewAbsPathFromExtPath ¶
NewAbsPathFromExtPath returns a new AbsPath by converting extPath to use slashes, performing tilde expansion, and making the path absolute.
func NormalizePath ¶
NormalizePath returns path normalized. On non-Windows systems, normalized paths are absolute paths.
func (AbsPath) JoinString ¶ added in v2.7.4
JoinString returns a new AbsPath with ss appended.
func (AbsPath) MarshalText ¶ added in v2.5.1
MarshalText implements encoding.TextMarshaler.MarshalText.
func (AbsPath) MustTrimDirPrefix ¶
MustTrimDirPrefix is like TrimPrefix but panics on any error.
func (AbsPath) TrimDirPrefix ¶
TrimDirPrefix trims prefix from p.
func (*AbsPath) UnmarshalText ¶ added in v2.5.1
UnmarshalText implements encoding.TextUnmarshaler.UnmarshalText.
type AbsPaths ¶
type AbsPaths []AbsPath
AbsPaths is a slice of RelPaths that implements sort.Interface.
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) 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) 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) ContentsSHA256 ¶
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) 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 ¶
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) LinknameSHA256 ¶
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) FileInfos ¶ added in v2.3.0
func (s *ArchiveReaderSystem) FileInfos() map[AbsPath]fs.FileInfo
FileInfos returns s's fs.FileInfos.
func (ArchiveReaderSystem) IdempotentCmdCombinedOutput ¶ added in v2.3.0
func (ArchiveReaderSystem) IdempotentCmdOutput ¶ added in v2.3.0
func (*ArchiveReaderSystem) Lstat ¶ added in v2.3.0
func (s *ArchiveReaderSystem) Lstat(filename AbsPath) (fs.FileInfo, error)
Lstat implements System.Lstat.
func (*ArchiveReaderSystem) ReadFile ¶ added in v2.3.0
func (s *ArchiveReaderSystem) ReadFile(name AbsPath) ([]byte, error)
ReadFile implements System.ReadFile.
func (*ArchiveReaderSystem) Readlink ¶ added in v2.3.0
func (s *ArchiveReaderSystem) Readlink(name AbsPath) (string, error)
Readlink implements System.Readlink.
func (ArchiveReaderSystem) RunIdempotentCmd ¶ added in v2.3.0
func (ArchiveReaderSystem) RunScript ¶ added in v2.3.0
func (ArchiveReaderSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
func (ArchiveReaderSystem) UnderlyingFS ¶ added in v2.3.0
func (ArchiveReaderSystem) WriteSymlink ¶ added in v2.3.0
type ArchiveReaderSystemOptions ¶ added in v2.3.0
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) CopyTo ¶
func (b *BoltPersistentState) CopyTo(p PersistentState) error
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 ¶
func (s *DebugPersistentState) CopyTo(p PersistentState) error
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 (*DebugSystem) Link ¶ added in v2.6.0
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 (*DebugSystem) Readlink ¶
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) WriteSymlink ¶
func (s *DebugSystem) WriteSymlink(oldname string, newname AbsPath) error
WriteSymlink implements System.WriteSymlink.
type DirAttr ¶
DirAttr holds attributes parsed from a source directory name.
func (DirAttr) MarshalZerologObject ¶ added in v2.5.0
MarshalZerologObject implements github.com/rs/zerolog.ObjectMarshaler.MarshalZerologObject.
func (DirAttr) SourceName ¶
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 (*DryRunSystem) Link ¶ added in v2.6.0
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 (*DryRunSystem) Readlink ¶
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) WriteSymlink ¶
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) IdempotentCmdCombinedOutput ¶
func (DumpSystem) IdempotentCmdOutput ¶
func (*DumpSystem) Mkdir ¶
func (s *DumpSystem) Mkdir(dirname AbsPath, perm fs.FileMode) error
Mkdir implements System.Mkdir.
func (DumpSystem) RunIdempotentCmd ¶ added in v2.1.5
func (*DumpSystem) RunScript ¶
func (s *DumpSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
RunScript implements System.RunScript.
func (*DumpSystem) UnderlyingFS ¶
func (s *DumpSystem) UnderlyingFS() vfs.FS
UnderlyingFS implements System.UnderlyingFS.
func (*DumpSystem) WriteSymlink ¶
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 (*ErrorOnWriteSystem) Link ¶ added in v2.9.5
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 (*ErrorOnWriteSystem) Readlink ¶ added in v2.9.5
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) WriteSymlink ¶ added in v2.9.5
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 (*ExternalDiffSystem) Link ¶ added in v2.6.0
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 (*ExternalDiffSystem) Readlink ¶ added in v2.1.5
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) WriteSymlink ¶ added in v2.1.5
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
MarshalZerologObject implements github.com/rs/zerolog.LogObjectMarshaler.MarshalZerologObject.
func (FileAttr) SourceName ¶
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.
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 (*GitDiffSystem) Link ¶ added in v2.6.0
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 (*GitDiffSystem) Readlink ¶
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) WriteSymlink ¶
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) MarshalText ¶
MarshalText implements encoding.TextMarshaler.MarshalText.
func (*HexBytes) UnmarshalText ¶
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
func (e InvalidArchiveFormatError) Error() string
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) CopyTo ¶
func (s *MockPersistentState) CopyTo(p PersistentState) error
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.
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) CopyTo ¶
func (NullPersistentState) CopyTo(s PersistentState) error
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) 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) Lstat ¶
func (s *ReadOnlySystem) Lstat(filename AbsPath) (fs.FileInfo, error)
Lstat implements System.Lstat.
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 (*ReadOnlySystem) Readlink ¶
func (s *ReadOnlySystem) Readlink(name AbsPath) (string, error)
Readlink implements System.Readlink.
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) WriteSymlink ¶
type ReadOptions ¶ added in v2.2.0
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 (*RealSystem) Link ¶ added in v2.6.0
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 (*RealSystem) Readlink ¶
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) WriteSymlink ¶
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
NewRelPath returns a new RelPath.
func (RelPath) AppendString ¶ added in v2.7.4
AppendString appends s to p.
func (RelPath) HasDirPrefix ¶
HasDirPrefix returns true if p has dir prefix dirPrefix.
func (RelPath) JoinString ¶ added in v2.7.4
JoinString returns a new RelPath with ss appended.
func (RelPath) MarshalJSON ¶ added in v2.7.4
MarshalJSON implements encoding.TextMarshaler.MarshalJSON.
type RelPaths ¶
type RelPaths []RelPath
RelPaths is a slice of RelPaths that implements sort.Interface.
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) 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 ¶
func (p SourceRelPath) Split() (SourceRelPath, SourceRelPath)
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) ContentsSHA256 ¶
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 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 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) Close ¶ added in v2.9.3
func (s *TarWriterSystem) Close() error
Close closes m.
func (TarWriterSystem) IdempotentCmdCombinedOutput ¶ added in v2.9.3
func (TarWriterSystem) IdempotentCmdOutput ¶ added in v2.9.3
func (*TarWriterSystem) Mkdir ¶ added in v2.9.3
func (s *TarWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error
Mkdir implements System.Mkdir.
func (TarWriterSystem) RunIdempotentCmd ¶ added in v2.9.3
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) UnderlyingFS ¶ added in v2.9.3
func (*TarWriterSystem) WriteSymlink ¶ added in v2.9.3
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) 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) ContentsSHA256 ¶
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) 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) ContentsSHA256 ¶
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 ¶
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) LinknameSHA256 ¶
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
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
An WalkArchiveFunc is called once for each entry in an archive.
type WalkSourceDirFunc ¶ added in v2.8.0
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) IdempotentCmdCombinedOutput ¶
func (ZIPWriterSystem) IdempotentCmdOutput ¶
func (*ZIPWriterSystem) Mkdir ¶
func (s *ZIPWriterSystem) Mkdir(name AbsPath, perm fs.FileMode) error
Mkdir implements System.Mkdir.
func (ZIPWriterSystem) RunIdempotentCmd ¶ added in v2.1.5
func (*ZIPWriterSystem) RunScript ¶
func (s *ZIPWriterSystem) RunScript(scriptname RelPath, dir AbsPath, data []byte, interpreter *Interpreter) error
RunScript implements System.RunScript.
func (ZIPWriterSystem) UnderlyingFS ¶
func (*ZIPWriterSystem) WriteSymlink ¶
func (s *ZIPWriterSystem) WriteSymlink(oldname string, newname AbsPath) error
WriteSymlink implements System.WriteSymlink.
Source Files ¶
- abspath.go
- actualstateentry.go
- ageencryption.go
- archive.go
- archivereadersystem.go
- attr.go
- autotemplate.go
- boltpersistentstate.go
- chezmoi.go
- chezmoi_go1.17.go
- chezmoi_unix.go
- data.go
- debugencryption.go
- debugpersistentstate.go
- debugsystem.go
- diff.go
- dryrunsystem.go
- dumpsystem.go
- encryption.go
- entrystate.go
- entrytypeset.go
- erroronwritesystem.go
- externaldiffsystem.go
- format.go
- gitdiffsystem.go
- gpgencryption.go
- hexbytes.go
- interpreter.go
- lazy.go
- mockpersistentstate.go
- mode.go
- noencryption.go
- nullpersistentstate.go
- path_unix.go
- patternset.go
- persistentstate.go
- readonlysystem.go
- realsystem.go
- realsystem_unix.go
- recursivemerge.go
- relpath.go
- sourcerelpath.go
- sourcestate.go
- sourcestateentry.go
- sourcestatetreenode.go
- stringset.go
- system.go
- targetstateentry.go
- tarwritersystem.go
- zipwritersystem.go