Documentation
¶
Index ¶
- func AppendPrefix(prefix string, keys []string) []string
- func ArrayShift(array *[]string, position int, value string)
- func ColorizeDiff(diff string) string
- func GenerateDiff(srcPath, destPath string, contextLines int) (string, error)
- func IsConfigChanged(src, dest string) (bool, error)
- func IsDirectory(path string) (bool, error)
- func IsFileExist(fpath string) bool
- func RecursiveDirsLookup(root string, pattern string) ([]string, error)
- func RecursiveFilesLookup(root string, pattern string) ([]string, error)
- func ValidateFormat(content []byte, format string) error
- type FileInfo
- type Nodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendPrefix ¶
AppendPrefix prepends the given prefix to each key in the slice.
func ArrayShift ¶
ArrayShift inserts a value at the specified position in the array.
func ColorizeDiff ¶
ColorizeDiff adds ANSI color codes to a diff string. Added lines (+) are green, removed lines (-) are red, and headers (@@) are cyan.
func GenerateDiff ¶
GenerateDiff generates a unified diff between two files. srcPath is the staged (new) file, destPath is the existing (old) file. contextLines specifies how many lines of context to include around changes.
func IsConfigChanged ¶
IsConfigChanged reports whether src and dest config files are equal. Two config files are equal when they have the same file contents and Unix permissions. The owner, group, and mode must match. It returns false in other cases.
This function is optimized to minimize syscalls by short-circuiting on metadata differences (size, mode, uid/gid) before computing MD5 hashes.
func IsDirectory ¶
func RecursiveFilesLookup ¶
func ValidateFormat ¶
ValidateFormat validates that the content is valid for the specified format. Supported formats: json, yaml, toml, xml Returns nil if valid, or an error describing the validation failure.