Documentation ¶
Index ¶
- Variables
- type CountViewMeta
- type FZF
- type FindOption
- type InputPosition
- type Items
- type KeyMap
- type Match
- type Matches
- type Option
- func WithCaseSensitive(s bool) Option
- func WithCountView(f func(meta CountViewMeta) string) Option
- func WithCountViewEnabled(b bool) Option
- func WithCursor(c string) Option
- func WithHotReload(locker sync.Locker) Option
- func WithInputPlaceholder(p string) Option
- func WithInputPosition(p InputPosition) Option
- func WithKeyMap(km KeyMap) Option
- func WithLimit(l int) Option
- func WithNoLimit(n bool) Option
- func WithPrompt(p string) Option
- func WithSelectedPrefix(p string) Option
- func WithStyles(opts ...StylesOption) Option
- func WithUnselectedPrefix(p string) Option
- type SearchOption
- type Style
- type Styles
- type StylesOption
- func WithStyleCursor(s Style) StylesOption
- func WithStyleCursorLine(s Style) StylesOption
- func WithStyleInputPlaceholder(s Style) StylesOption
- func WithStyleInputText(s Style) StylesOption
- func WithStyleMatches(s Style) StylesOption
- func WithStylePrompt(s Style) StylesOption
- func WithStyleSelectedPrefix(s Style) StylesOption
- func WithStyleUnselectedPrefix(s Style) StylesOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAbort is returned when a Fuzzy Finder is aborted. ErrAbort = errors.New("abort") )
Functions ¶
This section is empty.
Types ¶
type CountViewMeta ¶ added in v0.8.0
type CountViewMeta struct { ItemsCount int MatchesCount int SelectedCount int Width int Limit int NoLimit bool }
CountViewMeta provides information used in count view.
type FZF ¶
type FZF struct {
// contains filtered or unexported fields
}
Fuzzy Finder.
func (*FZF) Find ¶
func (fzf *FZF) Find(items interface{}, itemFunc func(i int) string, opts ...FindOption) ([]int, error)
Find launches the Fuzzy Finder and returns a list of indexes of the selected items.
func (*FZF) ForceReload ¶ added in v0.7.0
ForceReload forces the reload of items. HotReload must be enabled.
type FindOption ¶ added in v0.4.0
type FindOption func(o *findOption)
Option represents a option for the Find.
func WithItemPrefix ¶ added in v0.3.0
func WithItemPrefix(f func(i int) string) FindOption
WithItemPrefix sets the prefix function of the item.
func WithPreselect ¶ added in v0.15.0
func WithPreselect(idxs []int) FindOption
WithPreselect sets the preselected indexes.
func WithPreselectAll ¶ added in v0.14.0
func WithPreselectAll(preselect bool) FindOption
func WithPreviewWindow ¶ added in v0.13.0
func WithPreviewWindow(f func(i, width, height int) string) FindOption
WithPreviewWindow sets the preview window function of the item.
type InputPosition ¶ added in v0.11.0
type InputPosition string
InputPosition represents the position of input.
const ( InputPositionTop InputPosition = "top" InputPositionBottom InputPosition = "bottom" )
func (InputPosition) Valid ¶ added in v0.11.0
func (p InputPosition) Valid() error
Valid validates the value of InputPosition.
type Items ¶
type Items interface { // ItemString returns the string of the i-th item. ItemString(i int) string // Len returns the length of items. Len() int }
Items represents a list of items to be searched.
type Option ¶
type Option func(o *option)
Option represents a option for the Fuzzy Finder.
func WithCaseSensitive ¶ added in v0.7.0
WithCaseSensitive sets the case sensitivity.
func WithCountView ¶ added in v0.5.0
func WithCountView(f func(meta CountViewMeta) string) Option
WithCountView sets the function to create the count view.
func WithCountViewEnabled ¶ added in v0.5.0
WithCountViewEnabled enables or disables count view.
func WithHotReload ¶ added in v0.7.0
WithHotReload sets the locker for read items.
func WithInputPlaceholder ¶
WithInputPlaceholder sets the placeholder for input.
func WithInputPosition ¶ added in v0.11.0
func WithInputPosition(p InputPosition) Option
WithInputPosition sets the position of input.
func WithNoLimit ¶
WithNoLimit can be set to `true` to allow unlimited item selection.
func WithSelectedPrefix ¶
WithSelectedPrefix sets the prefix of the selected item.
func WithUnselectedPrefix ¶
WithUnselectedPrefix sets the prefix of the unselected item.
type SearchOption ¶ added in v0.8.0
type SearchOption func(o *searchOption)
SearchOption represents a option for a search.
func WithSearchCaseSensitive ¶ added in v0.8.0
func WithSearchCaseSensitive(c bool) SearchOption
type Style ¶
type Style struct { ForegroundColor string BackgroundColor string Bold bool Blink bool Italic bool Strikethrough bool Underline bool Faint bool }
Style represents a style.
type Styles ¶
type Styles struct {
// contains filtered or unexported fields
}
Styles is the styles for each component.
type StylesOption ¶
type StylesOption func(o *stylesOption)
Option represents a option for the styles.
func WithStyleCursor ¶
func WithStyleCursor(s Style) StylesOption
WithStyleCursor sets the style of cursor.
func WithStyleCursorLine ¶
func WithStyleCursorLine(s Style) StylesOption
WithStyleCursorLine sets the style of cursor line.
func WithStyleInputPlaceholder ¶ added in v0.10.0
func WithStyleInputPlaceholder(s Style) StylesOption
WithInputPlaceholder sets the style of placeholder for input.
func WithStyleInputText ¶ added in v0.10.0
func WithStyleInputText(s Style) StylesOption
WithStyleInputText sets the style of input text.
func WithStyleMatches ¶
func WithStyleMatches(s Style) StylesOption
WithStyleMatches sets the style of the matched characters.
func WithStylePrompt ¶ added in v0.10.0
func WithStylePrompt(s Style) StylesOption
WithStylePrompt sets the style of prompt.
func WithStyleSelectedPrefix ¶
func WithStyleSelectedPrefix(s Style) StylesOption
WithStyleSelectedPrefix sets the style of prefix of the selected item.
func WithStyleUnselectedPrefix ¶
func WithStyleUnselectedPrefix(s Style) StylesOption
WithStyleUnselectedPrefix sets the style of prefix of the unselected item.