fuzzy

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KEYWORD_TEXT   = janet.Keyword("text")
	KEYWORD_NODE   = janet.Keyword("node")
	KEYWORD_REPLAY = janet.Keyword("replay")
)
View Source
var BottomRight stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	location := geom.DEFAULT_SIZE
	location.C -= 1
	location.R -= 1
	return NewFuzzy(
		ctx,
		pokemonText,
		WithInline(location, geom.DEFAULT_SIZE),
	), nil
}
View Source
var FullBottom stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := NewFuzzy(
		ctx,
		pokemonText,
	)
	return f, nil
}
View Source
var FullBottomTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := NewFuzzy(
		ctx,
		pokemonTable,
		WithHeaders("Name", "#", "Type"),
	)
	return f, nil
}
View Source
var FullTop stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := NewFuzzy(
		ctx,
		pokemonText,
		WithReverse,
	)
	return f, nil
}
View Source
var FullTopTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := NewFuzzy(
		ctx,
		pokemonTable,
		WithReverse,
		WithHeaders("Name", "#", "Type"),
	)
	return f, nil
}
View Source
var Search stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	f := NewFuzzy(
		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 NewFuzzy(
		ctx,
		pokemonText,
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}
View Source
var TopLeftTable stories.InitFunc = func(ctx context.Context) (mux.Screen, error) {
	return NewFuzzy(
		ctx,
		pokemonTable,
		WithHeaders("Name", "#", "Type"),
		WithInline(geom.Size{}, geom.DEFAULT_SIZE),
	), nil
}

Functions

func NewFuzzy

func NewFuzzy(
	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 AttachEvent added in v0.1.5

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

type DetachEvent added in v0.1.5

type DetachEvent struct {
}

type Fuzzy

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

func (*Fuzzy) Attach added in v0.1.5

func (f *Fuzzy) Attach(id tree.NodeID) taro.Cmd

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
	// Supported types:
	// - string: will be passed to a blank terminal
	// - NodeID: will show in the background
	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) 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