Documentation ¶
Index ¶
- func AbsolutePath(path string) string
- func DirGlob(pattern string) []string
- func Exists(path string) bool
- func FileGlob(pattern string) []string
- func FilterByPattern(paths []string, caseInsensitive bool, patterns ...interface{}) (result []string)
- func Glob(pattern string) []string
- func HasWildcard(path string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func Join(sep string, elem ...string) (path string)
- func NormalizePath(path string) string
- func ReadFile(file string) (string, error)
- func ReadLines(file string) ([]string, error)
- func Sort(list []string, ignoreCase bool) []string
- func SplitLines(text string) []string
- type PathInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsolutePath ¶
AbsolutePath normalizes the given path and makes it absolute.
func FileGlob ¶
FileGlob resolves the given pattern into matching regular files. Errors are ignored.
func FilterByPattern ¶
func FilterByPattern(paths []string, caseInsensitive bool, patterns ...interface{}) (result []string)
FilterByPattern takes a list of paths and a list of patterns and returns all paths matching this pattern. Only the last path component (base path) is used when checking a pattern. Patterns can be strings containing wildcards or regular expressions.
func HasWildcard ¶
HasWildcard returns true if the given path contains a wildcard.
func NormalizePath ¶
NormalizePath normalizes the given path by changing the path separator to the OS specific separator.
func ReadFile ¶
ReadFile returns the contents of the given file as a string, or an error if the file could not be read.
func ReadLines ¶
ReadLines returns the contents of the given file, split into individual lines, or an error if the file could not be read.
func Sort ¶
Sort sorts the given list numerically/logically, optionally ignoring case. All numbers in the name are considered, so a1b2 < a2b2 < a10b2 < a10b10.
func SplitLines ¶
SplitLines splits the given text into individual lines, removing CR first and then splitting on LN indicating End-Of-Line.
Types ¶
type PathInfo ¶
PathInfo contains info about a file or directory
func ResolvePath ¶
ResolvePath checks whether the given path exists or uses Glob if it doesn't and returns a logically sorted slice of ResolvedPath structures describing the matching entries.