Documentation
¶
Index ¶
- Constants
- Variables
- func AbsolutizePaths(files []string) ([]string, error)
- func AppendIfNotPresent(target []string, elements ...string) []string
- func CopyDir(src string, dst string, extensions []string) (err error)
- func CopyFile(src, dst string) (err error)
- func ExecCommand(ctx *types.Context, command *exec.Cmd, stdout int, stderr int) ([]byte, []byte, error)
- func Filter(slice []string, fn filterFunc) []string
- func FilterDirs(files []os.FileInfo) []os.FileInfo
- func FilterFiles() filterFiles
- func FilterFilesWithExtensions(extensions ...string) filterFiles
- func FilterOutSCCS(file *paths.Path) bool
- func FilterReadableFiles(file *paths.Path) bool
- func FindFilesInFolder(dir *paths.Path, recurse bool, extensions []string) (paths.PathList, error)
- func IsHiddenFile(file os.FileInfo) bool
- func IsSCCSFile(file os.FileInfo) bool
- func IsSCCSOrHiddenFile(file os.FileInfo) bool
- func LogIfVerbose(warn bool, msg string) types.Command
- func MD5Sum(data []byte) string
- func Map(slice []string, fn mapFunc) []string
- func NormalizeUTF8(buf []byte) []byte
- func ParseCppString(line string) (string, string, bool)
- func PrintableCommand(parts []string) string
- func QuoteCppPath(path *paths.Path) string
- func QuoteCppString(str string) string
- func ReadDirFiltered(folder string, fn filterFiles) ([]os.FileInfo, error)
- func SliceContains(slice []string, target string) bool
- func TrimSpace(value string) string
- func WrapWithHyphenI(value string) string
Constants ¶
const ( Ignore = 0 // Redirect to null Show = 1 // Show on stdout/stderr as normal ShowIfVerbose = 2 // Show if verbose is set, Ignore otherwise Capture = 3 // Capture into buffer )
Variables ¶
var FilterOutHiddenFiles = paths.FilterOutPrefixes(".")
FilterOutHiddenFiles is a ReadDirFilter that exclude files with a "." prefix in their name
Functions ¶
func AbsolutizePaths ¶
func AppendIfNotPresent ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func ExecCommand ¶
func FilterFiles ¶
func FilterFiles() filterFiles
func FilterFilesWithExtensions ¶
func FilterFilesWithExtensions(extensions ...string) filterFiles
func FilterOutSCCS ¶
FilterOutSCCS is a ReadDirFilter that excludes known VSC or project files
func FilterReadableFiles ¶
FilterReadableFiles is a ReadDirFilter that accepts only readable files
func FindFilesInFolder ¶
func IsHiddenFile ¶
func IsSCCSFile ¶
func IsSCCSOrHiddenFile ¶
func NormalizeUTF8 ¶
Normalizes an UTF8 byte slice TODO: use it more often troughout all the project (maybe on logger interface?)
func ParseCppString ¶
Parse a C-preprocessor string as emitted by the preprocessor. This is a string contained in double quotes, with any backslashes or quotes escaped with a backslash. If a valid string was present at the start of the given line, returns the unquoted string contents, the remainder of the line (everything after the closing "), and true. Otherwise, returns the empty string, the entire line and false.
func PrintableCommand ¶
Convert a command and argument slice back to a printable string. This adds basic escaping which is sufficient for debug output, but probably not for shell interpretation. This essentially reverses ParseCommandLine.
func QuoteCppPath ¶
func QuoteCppString ¶
Returns the given string as a quoted string for use with the C preprocessor. This adds double quotes around it and escapes any double quotes and backslashes in the string.
func SliceContains ¶
func WrapWithHyphenI ¶
Types ¶
This section is empty.