gum/filter/options.go
Maas Lalani 9b3c8c0db0
Allow --value to pre-populate gum filter (#113)
* Add --value option to filter command

Modeled after fzf's --query option this allows the inital model to be
prefiltered.

Additionally, if the initial list, before being filtered by --value, is
empty then treat this as an error. Filtering an empty list doesn't make
sense.

Co-authored-by: David Morgan <david_a_morgan@icloud.com>
2022-08-08 16:54:24 -04:00

18 lines
1.1 KiB
Go

package filter
import "github.com/charmbracelet/gum/style"
// Options is the customization options for the filter command.
type Options struct {
Indicator string `help:"Character for selection" default:"•" env:"GUM_FILTER_INDICATOR"`
IndicatorStyle style.Styles `embed:"" prefix:"indicator." set:"defaultForeground=212" envprefix:"GUM_FILTER_INDICATOR_"`
TextStyle style.Styles `embed:"" prefix:"text." envprefix:"GUM_FILTER_TEXT_"`
MatchStyle style.Styles `embed:"" prefix:"match." set:"defaultForeground=212" envprefix:"GUM_FILTER_MATCH_"`
Placeholder string `help:"Placeholder value" default:"Filter..." env:"GUM_FILTER_PLACEHOLDER"`
Prompt string `help:"Prompt to display" default:"> " env:"GUM_FILTER_PROMPT"`
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240" envprefix:"GUM_FILTER_PROMPT_"`
Width int `help:"Input width" default:"20" env:"GUM_FILTER_WIDTH"`
Height int `help:"Input height" default:"0" env:"GUM_FILTER_HEIGHT"`
Value string `help:"Initial filter value" default:"" env:"GUM_FILTER_VALUE"`
}