utils

package
v0.0.0-...-0d042f0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2018 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SOURCE_CONTROL_FOLDERS = map[string]bool{"CVS": true, "RCS": true, ".git": true, ".github": true, ".svn": true, ".hg": true, ".bzr": true, ".vscode": true}

Functions

func AbsolutizePaths

func AbsolutizePaths(files []string) ([]string, error)

func AppendIfNotPresent

func AppendIfNotPresent(target []string, elements ...string) []string

func EnsureFolderExists

func EnsureFolderExists(folder string) error

func Filter

func Filter(slice []string, fn filterFunc) []string

func FilterDirs

func FilterDirs(files []os.FileInfo) []os.FileInfo

func FilterFiles

func FilterFiles() filterFiles

func FilterFilesWithExtensions

func FilterFilesWithExtensions(extensions ...string) filterFiles

func FilterOutFoldersByNames

func FilterOutFoldersByNames(folders []os.FileInfo, names ...string) []os.FileInfo

func FindFilesInFolder

func FindFilesInFolder(files *[]string, folder string, extensions CheckExtensionFunc, recurse bool) error

func GetParentFolder

func GetParentFolder(basefolder string, n int) string

func IsHiddenFile

func IsHiddenFile(file os.FileInfo) bool

func IsSCCSFile

func IsSCCSFile(file os.FileInfo) bool

func IsSCCSOrHiddenFile

func IsSCCSOrHiddenFile(file os.FileInfo) bool

func KeysOfMapOfString

func KeysOfMapOfString(input map[string]string) []string

func KeysOfMapOfStringInterface

func KeysOfMapOfStringInterface(input map[string]interface{}) []string

func LogIfVerbose

func LogIfVerbose(level string, format string, args ...interface{}) types.Command

func LogThis

func LogThis(level string, format string, args ...interface{}) types.Command

func MD5Sum

func MD5Sum(data []byte) string

func Map

func Map(slice []string, fn mapFunc) []string

func MapHas

func MapHas(aMap map[string]interface{}, key string) bool

func MapStringStringHas

func MapStringStringHas(aMap map[string]string, key string) bool

func NULLFile

func NULLFile() string

func ParseCommandLine

func ParseCommandLine(input string, logger i18n.Logger) ([]string, error)

func ParseCppString

func ParseCppString(line string) (string, string, bool)

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 PrepareCommand(pattern string, logger i18n.Logger) (*exec.Cmd, error)

func PrepareCommandFilteredArgs

func PrepareCommandFilteredArgs(pattern string, filter argFilterFunc, logger i18n.Logger) (*exec.Cmd, error)

func PrettyOSName

func PrettyOSName() string

func QuoteCppString

func QuoteCppString(str string) string

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 ReadDirFiltered

func ReadDirFiltered(folder string, fn filterFiles) ([]os.FileInfo, error)

func ReadFileToRows

func ReadFileToRows(file string) ([]string, error)

func SliceContains

func SliceContains(slice []string, target string) bool

func SliceToMapStringBool

func SliceToMapStringBool(keys []string, value bool) map[string]bool

func TheOnlySubfolderOf

func TheOnlySubfolderOf(folder string) (string, error)

func TouchFile

func TouchFile(targetFilePath string) error

func TrimSpace

func TrimSpace(value string) string

func WrapWithHyphenI

func WrapWithHyphenI(value string) string

func WriteFile

func WriteFile(targetFilePath string, data string) error

func WriteFileBytes

func WriteFileBytes(targetFilePath string, data []byte) error

Types

type CheckExtensionFunc

type CheckExtensionFunc func(ext string) bool

Jump to

Keyboard shortcuts

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