filter

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryFilter

type EntryFilter interface {
	ID() ID
	Filter(e *structure.Entry) bool
}

EntryFilter defines the interface for filtering entries

type FiltersList

type FiltersList map[ID]EntryFilter

func NewFiltersList

func NewFiltersList(ef ...EntryFilter) FiltersList

func (*FiltersList) Reset

func (fl *FiltersList) Reset()

func (*FiltersList) ToggleFilter

func (fl *FiltersList) ToggleFilter(id ID)

func (*FiltersList) Update

func (fl *FiltersList) Update(msg tea.Msg)

func (*FiltersList) Valid

func (fl *FiltersList) Valid(e *structure.Entry) bool

Valid returns true if the entry passes all filters

type ID

type ID string
const (
	// ID for the name filter
	NameFilterID ID = "NameFilter"
)

type NameFilter

type NameFilter struct {
	// contains filtered or unexported fields
}

NameFilter filters individual *structure.Entry instances by their path value. If an entry's path value does not contain the user input, it will not be filtered/discarded.

User input is handled by a textinput.Model instance, so the filter must update its internal state by providing the corresponding Updater implementation.

func NewNameFilter

func NewNameFilter(placeholder string) *NameFilter

NewNameFilter creates a new name filter.

func (*NameFilter) ClearInput

func (nf *NameFilter) ClearInput()

ClearInput clears the input content but keeps the filter enabled.

func (*NameFilter) Filter

func (nf *NameFilter) Filter(e *structure.Entry) bool

Filter filters a *structure.Entry by checking if its path value contains the current filter input.

func (*NameFilter) ID

func (nf *NameFilter) ID() ID

ID returns the unique identifier of the filter.

func (*NameFilter) IsEnabled

func (nf *NameFilter) IsEnabled() bool

IsEnabled returns whether the filter is enabled.

func (*NameFilter) Reset

func (nf *NameFilter) Reset()

func (*NameFilter) Toggle

func (nf *NameFilter) Toggle()

Toggle switches the enabled state of the filter.

func (*NameFilter) Update

func (nf *NameFilter) Update(msg tea.Msg)

func (*NameFilter) View

func (nf *NameFilter) View() string

type Reset

type Reset interface {
	Reset()
}

type Toggler

type Toggler interface {
	Toggle()
}

type Updater

type Updater interface {
	Update(msg tea.Msg)
}

Updater allows filters to update state during rendering

type Viewer

type Viewer interface {
	View() string
}

Viewer allows filters to be rendered

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL