Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirsFilter ¶
type DirsFilter struct {
// contains filtered or unexported fields
}
DirsFilter filters *Entry by its type and allows directories only.
func (*DirsFilter) ID ¶
func (df *DirsFilter) ID() ID
func (*DirsFilter) Reset ¶
func (df *DirsFilter) Reset()
func (*DirsFilter) Toggle ¶
func (df *DirsFilter) Toggle()
type EmptyDirFilter ¶ added in v0.1.2
type EmptyDirFilter struct{}
EmptyDirFilter filters empty directories. It checks the total number of files, including those in subdirectories, and discards it if it does not have any.
The filter does not affect file *Entry instances.
func (*EmptyDirFilter) Filter ¶ added in v0.1.2
func (edf *EmptyDirFilter) Filter(e *structure.Entry) bool
func (*EmptyDirFilter) ID ¶ added in v0.1.2
func (edf *EmptyDirFilter) ID() ID
type EntryFilter ¶
type EntryFilter interface {
// ID returns a filter identifier allowing to uniquely identify the filter.
ID() ID
// Filter contains the filtering logic and returns a bool value on whether
// the *Entry instance passed the filtration.
Filter(e *structure.Entry) bool
}
EntryFilter defines a contract for filtering a single *structure.Entry instance.
type FilesFilter ¶
type FilesFilter struct {
// contains filtered or unexported fields
}
FilesFilter filters *Entry by its type and allows files only.
func (*FilesFilter) ID ¶
func (df *FilesFilter) ID() ID
func (*FilesFilter) Reset ¶
func (df *FilesFilter) Reset()
func (*FilesFilter) Toggle ¶
func (df *FilesFilter) Toggle()
type FiltersList ¶
type FiltersList map[ID]EntryFilter
FiltersList aggregates a list of multiple filters.
func NewFiltersList ¶
func NewFiltersList(ef ...EntryFilter) FiltersList
NewFiltersList creates a new list of filters based on the provided argument. All filters should be disabled/inactive by default.
func (*FiltersList) Reset ¶
func (fl *FiltersList) Reset()
Reset traverses all filters in the list and calls EntryFilter.Reset method for each of them.
func (*FiltersList) ToggleFilter ¶
func (fl *FiltersList) ToggleFilter(id ID)
ToggleFilter enables or disables the provided filter by the provided unique filter name. Unknown filters that were not added to the list will be ignored.
func (*FiltersList) Update ¶
func (fl *FiltersList) Update(msg tea.Msg)
Update traverses all filters implementing the Updater interface in order to update the filters' state based on incoming input.
type NameFilter ¶
type NameFilter struct {
// contains filtered or unexported fields
}
NameFilter filters a single instance of the *structure.Entry by its path value. If the entry's path value does not contain the user's input, it will not be filtered/discarded.
The user's input is handled by the textinput.Model instance, therefore the filter must update internal state by providing the corresponding Updater implementation.
func NewNameFilter ¶
func NewNameFilter(textColor string) *NameFilter
func (*NameFilter) Filter ¶
func (nf *NameFilter) Filter(e *structure.Entry) bool
Filter filters an instance of *structure.Entry by checking if its path value contains the current filter input.
func (*NameFilter) ID ¶
func (nf *NameFilter) ID() ID
func (*NameFilter) Reset ¶
func (nf *NameFilter) Reset()
func (*NameFilter) Toggle ¶
func (nf *NameFilter) Toggle()
func (*NameFilter) Update ¶
func (nf *NameFilter) Update(msg tea.Msg)
func (*NameFilter) View ¶
func (nf *NameFilter) View() string
type NameFilterType ¶ added in v0.11.0
type NameFilterType int
NameFilterType represents a filter type that will be applied during the filtering process.
const ( // RegularNameFilter represents a default filter type where the filter value // must be a substring of the original text. RegularNameFilter NameFilterType = iota // NegativeNameFilter represents a filter type with the behavior opposite to // RegularNameFilter. It's enabled by the "\" backslash prefix at the beginning // of the filter input. NegativeNameFilter // RegexNameFilter represents a regular expression filter type where the // filter input will be treated as a valid regular expression. It's enabled // by the ":" colon prefix at the beginning of the filter input. RegexNameFilter )
type Reset ¶ added in v0.1.2
type Reset interface {
Reset()
}
Reset resets the filter's state and disables it.
type Toggler ¶ added in v0.1.2
type Toggler interface {
Toggle()
}
Toggler enables or disables the filter.