filter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package filter provides a fuzzy searching text input to allow filtering a list of options to select one option.

By default it will list all the files (recursively) in the current directory for the user to choose one, but the script (or user) can provide different new-line separated options to choose from.

I.e. let's pick from a list of gum flavors:

$ cat flavors.text | gum filter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Indicator      string       `help:"Character for selection" default:"•"`
	IndicatorStyle style.Styles `embed:"" prefix:"indicator." set:"defaultForeground=212" set:"name=indicator"`
	TextStyle      style.Styles `embed:"" prefix:"text."`
	MatchStyle     style.Styles `embed:"" prefix:"match." set:"defaultForeground=212" set:"name=matched text"`
	Placeholder    string       `help:"Placeholder value" default:"Filter..."`
	Prompt         string       `help:"Prompt to display" default:"> "`
	PromptStyle    style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240" set:"name=prompt"`
	Width          int          `help:"Input width" default:"20"`
	Height         int          `help:"Input height" default:"0"`
}

Options is the customization options for the filter command. nolint:staticcheck

func (Options) BeforeReset

func (o Options) BeforeReset(ctx *kong.Context) error

BeforeReset hook. Used to unclutter style flags.

func (Options) Run

func (o Options) Run() error

Run provides a shell script interface for filtering through options, powered by the textinput bubble.

Jump to

Keyboard shortcuts

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