Documentation
¶
Index ¶
- func Contains(input []Entry, needle string) bool
- func OnlyNames(input []Entry) []string
- func WatchDir(ctx context.Context, inputPath string, filter WatchFilter, ...) error
- type DateEntitiesFilter
- type DateWatchFilter
- type EntriesFilter
- type Entry
- func FilterEntities(files []Entry, filter EntriesFilter) []Entry
- func ListFiles(inputPath string) ([]Entry, error)
- func ListFilesWithDateFilter(inputPath string, beginTime, endTime time.Time) ([]Entry, error)
- func ListFilesWithFilter(inputPath string, filterRegex *regexp.Regexp) ([]Entry, error)
- func ListFilesWithMapFilter(inputPath string, skipMap map[string]struct{}) ([]Entry, error)
- func ListFilesWithPermissionsFilter(inputPath string, min, max uint32) ([]Entry, error)
- func ListFilesWithSizeFilter(inputPath string, min, max int64) ([]Entry, error)
- func NewEntry(inputPath string) (Entry, error)
- func OnlyDirs(input []Entry) []Entry
- func OnlyFiles(input []Entry) []Entry
- type NoopEntriesFilter
- type NoopWatchFilter
- type Path
- type PermissionsEntitiesFilter
- type PermissionsWatchFilter
- type RegexEntitiesFilter
- type RegexWatchFilter
- type SizeEntitiesFilter
- type SizeWatchFilter
- type SkipMapEntitiesFilter
- type SkipMapWatchFilter
- type WatchEvent
- type WatchFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnlyNames ¶ added in v0.6.0
OnlyNames returns a slice of absolute paths (strings) from a given Entry slice.
func WatchDir ¶ added in v0.12.0
func WatchDir(ctx context.Context, inputPath string, filter WatchFilter, files chan WatchEvent) error
Types ¶
type DateEntitiesFilter ¶ added in v0.12.0
type DateEntitiesFilter struct {
// contains filtered or unexported fields
}
DateEntitiesFilter filters fs events by matching ensuring ModTime is within the given date range.
func NewDateEntitiesFilter ¶ added in v0.12.0
func NewDateEntitiesFilter(from, to time.Time) DateEntitiesFilter
type DateWatchFilter ¶ added in v0.12.0
type DateWatchFilter struct {
// contains filtered or unexported fields
}
DateWatchFilter filters fs events by matching ensuring ModTime is within the given date range.
func NewDateWatchFilter ¶ added in v0.12.0
func NewDateWatchFilter(from, to time.Time) DateWatchFilter
type EntriesFilter ¶ added in v0.12.0
type EntriesFilter interface {
// contains filtered or unexported methods
}
EntitiesFilter interface facilitates filtering entry slices.
type Entry ¶ added in v0.6.0
Entry is the currency of this package.
func FilterEntities ¶ added in v0.12.0
func FilterEntities(files []Entry, filter EntriesFilter) []Entry
FilterEntities removes files from the slice if they are not accepted by the given filter function.
func ListFilesWithDateFilter ¶ added in v0.6.0
ListFilesWithDateFilter recursively lists all files, filtering based on modtime.
func ListFilesWithFilter ¶
ListFilesWithFilter recursively lists all files, filtering the names based on the given regex.
func ListFilesWithMapFilter ¶ added in v0.6.0
ListFilesWithMapFilter recursively lists all files skipping those that exist in the skip map.
func ListFilesWithPermissionsFilter ¶ added in v0.6.0
ListFilesWithPermissionsFilter recursively lists all files skipping those that are not in the given range, inclusive.
func ListFilesWithSizeFilter ¶ added in v0.6.0
ListFilesWithSizeFilter recursively lists all files skipping those that are not in the given range, inclusive.
func NewEntry ¶ added in v0.12.0
NewEntry takes a filepath and expands ~ as well as other relative paths to absolute and stats them returning Entry.
func OnlyDirs ¶ added in v0.6.0
OnlyDirs filters an input slice by returning a slice containing only directories.
type NoopEntriesFilter ¶ added in v0.12.0
type NoopEntriesFilter struct{}
NoopEntriesFilter always returns true, useful for testing.
type NoopWatchFilter ¶ added in v0.12.0
type NoopWatchFilter struct{}
type Path ¶
type Path struct {
GivenInput string // exactly what the user typed
ComputedPath Entry // converts relative paths to absolute
Files []Entry
}
Path is a type whose sole purpose is to furfil the flag interface
func (*Path) Get ¶
Get fulfils the flag.Getter interface https://pkg.go.dev/flag#Getter
func (*Path) Set ¶
Set fulfils the flag.Value interface https://pkg.go.dev/flag#Value
func (Path) String ¶
String fulfils the flag.Value interface https://pkg.go.dev/flag#Value
type PermissionsEntitiesFilter ¶ added in v0.12.0
type PermissionsEntitiesFilter struct {
// contains filtered or unexported fields
}
PermissionsEntitiesFilter filters fs events by ensuring the given file permissions are within the given range.
func NewPermissionsEntitiesFilter ¶ added in v0.12.0
func NewPermissionsEntitiesFilter(min, max uint32) PermissionsEntitiesFilter
type PermissionsWatchFilter ¶ added in v0.12.0
type PermissionsWatchFilter struct {
// contains filtered or unexported fields
}
PermissionsWatchFilter filters fs events by ensuring the given file permissions are within the given range.
func NewPermissionsWatchFilter ¶ added in v0.12.0
func NewPermissionsWatchFilter(min, max uint32) PermissionsWatchFilter
type RegexEntitiesFilter ¶ added in v0.12.0
type RegexEntitiesFilter struct {
// contains filtered or unexported fields
}
RegexEntitiesFilter filters fs events by matching file names to a given regex.
func NewRegexEntitiesFilter ¶ added in v0.12.0
func NewRegexEntitiesFilter(filterRegex *regexp.Regexp) RegexEntitiesFilter
type RegexWatchFilter ¶ added in v0.12.0
type RegexWatchFilter struct {
// contains filtered or unexported fields
}
RegexWatchFilter filters fs events by matching file names to a given regex.
func NewRegexWatchFilter ¶ added in v0.12.0
func NewRegexWatchFilter(filterRegex *regexp.Regexp) RegexWatchFilter
type SizeEntitiesFilter ¶ added in v0.12.0
type SizeEntitiesFilter struct {
// contains filtered or unexported fields
}
SizeEntitiesFilter filters fs events by ensuring the given file within the given size range (in bytes).
func NewSizeEntitiesFilter ¶ added in v0.12.0
func NewSizeEntitiesFilter(min, max int64) SizeEntitiesFilter
type SizeWatchFilter ¶ added in v0.12.0
type SizeWatchFilter struct {
// contains filtered or unexported fields
}
SizeWatchFilter filters fs events by ensuring the given file within the given size range (in bytes).
func NewSizeWatchFilter ¶ added in v0.12.0
func NewSizeWatchFilter(min, max int64) SizeWatchFilter
type SkipMapEntitiesFilter ¶ added in v0.12.0
type SkipMapEntitiesFilter struct {
// contains filtered or unexported fields
}
SkipMapEntitiesFilter filters fs events by ensuring the given file is NOT within the given map.
func NewSkipMapEntitiesFilter ¶ added in v0.12.0
func NewSkipMapEntitiesFilter(skipMap map[string]struct{}) SkipMapEntitiesFilter
type SkipMapWatchFilter ¶ added in v0.12.0
type SkipMapWatchFilter struct {
// contains filtered or unexported fields
}
SkipMapWatchFilter filters fs events by ensuring the given file is NOT within the given map.
func NewSkipMapWatchFilter ¶ added in v0.12.0
func NewSkipMapWatchFilter(skipMap map[string]struct{}) SkipMapWatchFilter
type WatchEvent ¶ added in v0.12.1
type WatchFilter ¶ added in v0.12.0
type WatchFilter interface {
// contains filtered or unexported methods
}
WatchFilter interface facilitates filtering of file events.