Documentation
¶
Index ¶
- Constants
- Variables
- func AbsolutizePaths(files []string) ([]string, error)
- func AppendIfNotPresent(target []string, elements ...string) []string
- func CopyDir(src string, dst string, extensions CheckExtensionFunc) (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 FindAllSubdirectories(folder string, output *[]string) error
- func FindFilesInFolder(files *[]string, folder string, extensions CheckExtensionFunc, recurse bool) error
- func IsHiddenFile(file os.FileInfo) bool
- func IsSCCSFile(file os.FileInfo) bool
- func IsSCCSOrHiddenFile(file os.FileInfo) bool
- func LogIfVerbose(level string, format string, args ...interface{}) types.Command
- func MD5Sum(data []byte) string
- func Map(slice []string, fn mapFunc) []string
- func MapStringStringHas(aMap map[string]string, key string) bool
- func NormalizeUTF8(buf []byte) []byte
- func ParseCommandLine(input string, logger i18n.Logger) ([]string, error)
- func ParseCppString(line string) (string, string, bool)
- func PrepareCommand(pattern string, logger i18n.Logger, relativePath string) (*exec.Cmd, error)
- func PrepareCommandFilteredArgs(pattern string, filter argFilterFunc, logger i18n.Logger, relativePath string) (*exec.Cmd, error)
- func PrettyOSName() string
- 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
- type CheckExtensionFunc
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 ¶
Functions ¶
func AbsolutizePaths ¶
func AppendIfNotPresent ¶
func CopyDir ¶
func CopyDir(src string, dst string, extensions CheckExtensionFunc) (err error)
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 FindAllSubdirectories ¶
func FindFilesInFolder ¶
func FindFilesInFolder(files *[]string, folder string, extensions CheckExtensionFunc, recurse bool) error
func IsHiddenFile ¶
func IsSCCSFile ¶
func IsSCCSOrHiddenFile ¶
func LogIfVerbose ¶
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 remaineder of the line (everything after the closing "), and true. Otherwise, returns the empty string, the entire line and false.
func PrepareCommand ¶
func PrettyOSName ¶
func PrettyOSName() string
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 QuoteCppPath(path *paths.Path) string
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.