fuzzy

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 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 added in v0.1.13

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

func WithReverse added in v0.1.6

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

func WithSticky added in v0.1.6

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 added in v0.1.1

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

func (*Fuzzy) Update added in v0.1.1

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

func (*Fuzzy) View added in v0.1.1

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 added in v0.1.6

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

func UnmarshalOptions

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

type SelectedEvent added in v0.1.6

type SelectedEvent struct {
	Option Option
}

type Setting added in v0.1.6

type Setting func(context.Context, *Fuzzy)

func WithAnimation added in v0.1.6

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

func WithHeaders added in v0.1.11

func WithHeaders(headers ...string) Setting

func WithInline added in v0.1.6

func WithInline(location, size geom.Vec2) Setting

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

func WithNodes added in v0.1.6

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

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

func WithPrompt added in v0.1.6

func WithPrompt(prompt string) Setting

func WithResult added in v0.1.6

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