mirror of
https://github.com/charmbracelet/gum
synced 2024-05-23 08:32:21 +02:00
9b3c8c0db0
* 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>
18 lines
1.1 KiB
Go
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"`
|
|
}
|