fuzzy

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 21 Imported by: 0

README

fuzzy

Package fuzzy is a fully-featured fuzzy finder a la fzf. In fact, it makes use of fzf's actual agorithm, forked here as the fuzzy/fzf package.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BottomRight stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	location := geom.DEFAULT_SIZE
	location.C -= 1
	location.R -= 1
	return New(
		ctx,
		pokemonText,
		WithInline(location, geom.DEFAULT_SIZE),
	), nil
}
View Source
var CommandTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	return New(
		ctx,
		[]Option{
			newColumnOption("ll", "/foo/bar"),
			newColumnOption("ll", "/foo/bar"),
			newColumnOption("longer command", "/foo/bar"),
		},
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}
View Source
var FullBottom stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		pokemonText,
	)
	return f, nil
}
View Source
var FullBottomTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		pokemonTable,
		WithHeaders("Name", "#", "Type"),
	)
	return f, nil
}
View Source
var FullTop stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		pokemonText,
		WithReverse,
	)
	return f, nil
}
View Source
var FullTopTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		pokemonTable,
		WithReverse,
		WithHeaders("Name", "#", "Type"),
	)
	return f, nil
}
View Source
var Search stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := New(
		ctx,
		pokemonText,
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	)

	stories.Send(f, "Pid")
	return f, nil
}
View Source
var TopLeft stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	return New(
		ctx,
		pokemonText,
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}
View Source
var TopLeftTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	return New(
		ctx,
		pokemonTable,
		WithHeaders("Name", "#", "Type"),
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}

Functions

func New

func New(
	ctx context.Context,
	options []Option,
	settings ...Setting,
) *taro.Program

func WithReverse

func WithReverse(ctx context.Context, f *Fuzzy)

func WithSticky

func WithSticky(ctx context.Context, f *Fuzzy)

Don't allow Fuzzy to quit.

Types

type Fuzzy

type Fuzzy struct {
	util.Lifetime
	// contains filtered or unexported fields
}

func (*Fuzzy) Init

func (f *Fuzzy) Init() taro.Cmd

func (*Fuzzy) Update

func (f *Fuzzy) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Fuzzy) View

func (f *Fuzzy) View(state *tty.State)

type Match

type Match struct {
	Score int
	Index *[]int
}

type Option

type Option struct {
	Text    string
	Columns []string
	Preview interface{}
	Chars   *util.Chars
	Match   *Match
	Result  interface{}
}

func Filter

func Filter(options []Option, search string) []Option

func NewOption

func NewOption(text string, result interface{}) Option

func UnmarshalOptions

func UnmarshalOptions(input *janet.Value) (result []Option, err error)

type SelectedEvent

type SelectedEvent struct {
	Option Option
}

type Setting

type Setting func(context.Context, *Fuzzy)

func WithAnimation

func WithAnimation(image image.Image, creator anim.Creator) Setting

func WithHeaders

func WithHeaders(headers ...string) Setting

func WithInline

func WithInline(location, size geom.Vec2) Setting

Displays Fuzzy as a small window at this location on the screen.

func WithNodes

func WithNodes(t *tree.Tree, client *server.Client) Setting

If both of these are provided, Fuzzy can show previews for panes.

func WithPrompt

func WithPrompt(prompt string) Setting

func WithResult

func WithResult(result chan<- interface{}) Setting

Directories

Path Synopsis
fzf

Jump to

Keyboard shortcuts

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