Documentation
¶
Index ¶
- Constants
- func DirectoryExists(dirname string) bool
- func FileExists(filename string) bool
- func GetULimit() (syscall.Rlimit, error)
- func GlobRoot(glob string) (string, string, error)
- func InclusionsFromExtensions(extensions []string) []string
- func InclusionsFromFiles(filenames []string) []string
- func ListFiles(listPath string, opts *ListOptions) ([]string, error)
- func ListFilesWithContext(ctx context.Context, listPath string, opts *ListOptions) ([]string, error)
- func Match(pattern, value string, options ...MatchOption) bool
- func ResolveGlobRoots(pattern []string, rootPaths ...string) []string
- func SetULimit(ulimit uint64) error
- func ShouldIncludePath(path string, include, exclude []string) bool
- func SplitPath(path string) []string
- func Tildefy(filePath string) (string, error)
- type ListFlag
- type ListOptions
- type MatchOption
Constants ¶
const ( // Files lists only files Files ListFlag = 1 << iota // Directories lists only directories Directories // Recursively traverses directories Recursive // Ignores empty directories NotEmpty AllFlat = Files | Directories AllRecursive = Files | Directories | Recursive FilesRecursive = Files | Recursive DirectoriesRecursive = Directories | Recursive FilesFlat = Files DirectoriesFlat = Directories )
Variables ¶
This section is empty.
Functions ¶
func DirectoryExists ¶ added in v0.5.0
func FileExists ¶ added in v0.5.0
FileExists checks if a file exists and is not a directory
func GlobRoot ¶ added in v0.5.0
GlobRoot takes in a glob and tries to resolve the prefix of the glob such that the prefix exists in the filesystem.
If the given glob is relative, then GlobRoot converts it into an absolute path before attempting resolution.
If the given glob is can be resolved to an existing file in the system, then the parent directory of the file along with the full path of the file is returned
func InclusionsFromExtensions ¶
InclusionsFromExtensions takes a list of file extensions and convert into a .gitgnore format inclusions list
func InclusionsFromFiles ¶
InclusionsFromFiles takes a list of file names convert into a .gitgnore format inclusions list
func ListFiles ¶
func ListFiles(listPath string, opts *ListOptions) ([]string, error)
ListFiles returns path of files and or folders under listPath inclusions/exclusions/recursion is defined by opts
func ListFilesWithContext ¶ added in v0.9.0
func Match ¶ added in v0.5.0
func Match(pattern, value string, options ...MatchOption) bool
func ResolveGlobRoots ¶ added in v0.5.0
ResolveGlobRoots resolve the glob patter for each of the given root paths
func ShouldIncludePath ¶
ShouldIncludePath returns whether the specified file path satisfies the inclusion and exclusion options (in .gitignore format) Note: it is expected the pattern will be absolute, i.e including the base path: /tmp/foo/**/*.json
Types ¶
type ListOptions ¶
type MatchOption ¶ added in v0.6.0
type MatchOption func(config *matchConfig)
var WithAsDir MatchOption = func(config *matchConfig) { config.asDir = true }