Documentation
¶
Index ¶
- func CopyFile(sourcePath string, destinationPath string) error
- func Eq(a, b int) bool
- func Ge(a, b int) bool
- func Gt(a, b int) bool
- func Le(a, b int) bool
- func Lt(a, b int) bool
- func Ne(a, b int) bool
- func ReadFile(filePath string) ([]byte, error)
- func ReadFileLineByLine(filePath string) ([]string, error)
- func Watch(inclusionPaths []string, exclusionPaths []string, verbose bool, ...) error
- func WriteFile(filePath string, content []byte) error
- type ComparisonOperator
- type FileList
- func (fileList FileList) Add(filePathsToAdd ...string) FileList
- func (fileList FileList) AddPrefixToAllPaths(prefix string) FileList
- func (fileList FileList) Filter(filterFunc func(string) bool) FileList
- func (fileList FileList) FilterByExtension(extension string) FileList
- func (fileList FileList) FilterByFilename(name string) FileList
- func (fileList FileList) FilterByFilenameContains(nameSubstring string) FileList
- func (fileList FileList) FilterByFilenameRegex(regex string) FileList
- func (fileList FileList) FilterByFolderPath(subPath string) FileList
- func (fileList FileList) FilterByIgnoreLines(ignoreLines []string) FileList
- func (fileList FileList) FilterByLevel(level int) FileList
- func (fileList FileList) FilterByLevelAtFolderPath(path string, level int) FileList
- func (fileList FileList) FilterBySiblingAmount(comparisonOperator ComparisonOperator, amount int) FileList
- func (fileList FileList) FilterByTreePath(treepath string) FileList
- func (fileList FileList) Remove(filePathsToRemove ...string) FileList
- func (fileList FileList) RemovePrefixFromAllPaths(prefix string) FileList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
Copies the specified sourcePath to the destinationPath Will NOT create the required folders. If the specified sourcePath is a folder, it will create the folder at the destination, but not copy the contents (== non-recursive). This copy process respects permissions of the sourcePaths while creating the new files/folders. The destinationPath must not exist.
func ReadFileLineByLine ¶
Returns the contents of the file at the provided path
Types ¶
type ComparisonOperator ¶ added in v1.0.1
type FileList ¶
func GenerateFileList ¶
Returns a fileList with the paths of all files within the provided path (recursive traversal)
func GenerateFileListWithIgnoreLines ¶
func GenerateFileListWithIgnoreLines(fileListPath string, ignoreLines []string, verbose bool) (FileList, error)
Returns a fileList with the paths of all files within the provided path (recursive traversal) Will remove the ignored paths before returning the list.
func (FileList) AddPrefixToAllPaths ¶
Adds the specified prefix to every filePath in fileList.Files
func (FileList) Filter ¶
Filters the fileList based on the provided function. The provided function gets each filePath as argument and should return whether it should be included or not. Inclusion means it is still contained in the returned fileList Implicitly tested by all the other included Filters
func (FileList) FilterByExtension ¶ added in v1.0.1
Retain those filePaths that have the specified extension Format must be `.ext`
func (FileList) FilterByFilename ¶
Retain those filePaths that have the specified fileName
func (FileList) FilterByFilenameContains ¶
Retain only those filePaths, where the fileName contains the specified subString
func (FileList) FilterByFilenameRegex ¶ added in v1.0.1
Retain those filePaths that match the specified regular expression
func (FileList) FilterByFolderPath ¶
Retains all paths in FileList that match a specific subpath. If the path doesn't exist, the result is empty. Requires a trailing slash. If there is none, it will be automatically added temporarily.
func (FileList) FilterByIgnoreLines ¶
Removes all filePaths from fileList.Files that match the specified ignoreLines. IgnoreLines are in the format as they are in any .gitignore.
func (FileList) FilterByLevel ¶
Retains all filePaths that have the exact specified level from the root position. Works by counting slashes.
func (FileList) FilterByLevelAtFolderPath ¶
Retains the filepaths below the provided path, which are the specified amount of path-levels below it Requires a trailing slash. If there is none, it will be automatically added temporarily. The trailing slash is to ensure that not multiple folder names match (e.g. `a/b/` vs `a/bc/` which might both match `a/b`)
func (FileList) FilterBySiblingAmount ¶ added in v1.0.1
func (fileList FileList) FilterBySiblingAmount(comparisonOperator ComparisonOperator, amount int) FileList
Retains all filePaths that have the exact specified amount of sibling files.
func (FileList) FilterByTreePath ¶
Retains all filePaths that match the specified treepath This means from the root down to the lowest folder, only files in those directories are retained.
func (FileList) RemovePrefixFromAllPaths ¶
Removes the specified prefix to every filePath in fileList.Files
Source Files
¶
- ComparisonOperators.go
- CopyFile.go
- Eq.go
- FileList.go
- FileList_Add.go
- FileList_AddPrefixToAllPaths.go
- FileList_Filter.go
- FileList_FilterByExtension.go
- FileList_FilterByFilename.go
- FileList_FilterByFilenameContains.go
- FileList_FilterByFilenameRegex.go
- FileList_FilterByIgnoreLines.go
- FileList_FilterByLevel.go
- FileList_FilterByLevelAtFolderPath.go
- FileList_FilterBySiblingAmount.go
- FileList_FilterBySubPath.go
- FileList_FilterByTreePath.go
- FileList_Generate.go
- FileList_GenerateWithIgnoreLines.go
- FileList_Remove.go
- FileList_RemovePrefixFromAllPaths.go
- Ge.go
- Gt.go
- Le.go
- Lt.go
- Ne.go
- ReadFile.go
- ReadFileLineByLine.go
- Watch.go
- WriteFile.go
- ensureNoTrailingSlash.go
- ensureTrailingSlash.go