Documentation ¶
Index ¶
- func CopyFile(src, dst string) error
- func DirectoryExists(dir string) bool
- func ExecutableDir() string
- func FileContainsString(file string, str string) bool
- func FileExists(filename string) bool
- func FindFiles(rootPath string, ignore IgnoreFunc, filter FilterFunc) ([]string, error)
- func FindFilesByExtension(rootPath string, extensions []string) ([]string, error)
- func GenerateFileMapByDeepExtension(files []string) map[string][]string
- func GenerateFileMapByExtension(files []string) map[string][]string
- func GetFileBytes(file string) ([]byte, error)
- func GetFileContent(file string) (string, error)
- func GetPathRelativeToDirectory(currentDirectory string, rootDirectory string) string
- func GetProjectDirectory() (string, error)
- func MoveFile(oldLocation string, newLocation string) error
- func RemoveFile(file string) error
- func SaveFileText(file string, content string) error
- func WorkingDirOrPanic() string
- type FilterFunc
- type IgnoreFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectoryExists ¶
DirectoryExists checks if the dir exists
func ExecutableDir ¶
func ExecutableDir() string
ExecutableDir returns the directory of the current executable
func FileContainsString ¶
FileContainsString will check if a file contains the string
func FindFiles ¶
func FindFiles(rootPath string, ignore IgnoreFunc, filter FilterFunc) ([]string, error)
FindFiles will return all files in a directory ignoreFunc can be used to skip directories or files filterFunc is used to evaluate if a file should be included in the result
func FindFilesByExtension ¶
FindFilesByExtension will return all files with a specific extension in a directory
func GenerateFileMapByDeepExtension ¶
GenerateFileMapByDeepExtension will return a map of files by extension Supports multiple dots in the file name, see GenerateFileMapByExtension for one dot Example: {"go": ["file1.go", "file2.go"], "txt": ["file1.txt"], "tar.gz": ["file1.tar.gz"]}
func GenerateFileMapByExtension ¶
GenerateFileMapByExtension will return a map of files by extension Supports one dot in the file name, see GenerateFileMapByDeepExtension for multiple dots Example: {"go": ["file1.go", "file2.go"], "txt": ["file1.txt"], "gz": ["file1.tar.gz"]}
func GetFileBytes ¶
GetFileBytes will retrieve the content of a file as bytes
func GetFileContent ¶
GetFileContent will retrieve the content of a file as text
func GetPathRelativeToDirectory ¶
GetPathRelativeToDirectory returns the relative path in relation to the rootDirectory
func GetProjectDirectory ¶
GetProjectDirectory will try to find the project directory based on repository folders (.git)
func SaveFileText ¶
SaveFileText will save a file with the provided content
func WorkingDirOrPanic ¶
func WorkingDirOrPanic() string
WorkingDirOrPanic returns the current working directory or panics