mirror of
https://github.com/charmbracelet/gum
synced 2024-06-18 05:25:23 +02:00
feat(filter): allow customizing placeholder
This commit is contained in:
parent
7e5b494ae4
commit
2d896f777e
|
@ -26,6 +26,7 @@ func (o Options) Run() error {
|
||||||
|
|
||||||
i.Prompt = o.Prompt
|
i.Prompt = o.Prompt
|
||||||
i.PromptStyle = o.PromptStyle.ToLipgloss()
|
i.PromptStyle = o.PromptStyle.ToLipgloss()
|
||||||
|
i.PlaceholderStyle = o.PlaceholderStyle.ToLipgloss()
|
||||||
i.Placeholder = o.Placeholder
|
i.Placeholder = o.Placeholder
|
||||||
i.Width = o.Width
|
i.Width = o.Width
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ type Options struct {
|
||||||
Placeholder string `help:"Placeholder value" default:"Filter..." env:"GUM_FILTER_PLACEHOLDER"`
|
Placeholder string `help:"Placeholder value" default:"Filter..." env:"GUM_FILTER_PLACEHOLDER"`
|
||||||
Prompt string `help:"Prompt to display" default:"> " env:"GUM_FILTER_PROMPT"`
|
Prompt string `help:"Prompt to display" default:"> " env:"GUM_FILTER_PROMPT"`
|
||||||
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240" envprefix:"GUM_FILTER_PROMPT_"`
|
PromptStyle style.Styles `embed:"" prefix:"prompt." set:"defaultForeground=240" envprefix:"GUM_FILTER_PROMPT_"`
|
||||||
|
PlaceholderStyle style.Styles `embed:"" prefix:"placeholder." set:"defaultForeground=240" envprefix:"GUM_FILTER_PLACEHOLDER_"`
|
||||||
Width int `help:"Input width" default:"20" env:"GUM_FILTER_WIDTH"`
|
Width int `help:"Input width" default:"20" env:"GUM_FILTER_WIDTH"`
|
||||||
Height int `help:"Input height" default:"0" env:"GUM_FILTER_HEIGHT"`
|
Height int `help:"Input height" default:"0" env:"GUM_FILTER_HEIGHT"`
|
||||||
Value string `help:"Initial filter value" default:"" env:"GUM_FILTER_VALUE"`
|
Value string `help:"Initial filter value" default:"" env:"GUM_FILTER_VALUE"`
|
||||||
|
|
|
@ -11,7 +11,7 @@ type Options struct {
|
||||||
Placeholder string `help:"Placeholder value" default:"Type something..." env:"GUM_INPUT_PLACEHOLDER"`
|
Placeholder string `help:"Placeholder value" default:"Type something..." env:"GUM_INPUT_PLACEHOLDER"`
|
||||||
Prompt string `help:"Prompt to display" default:"> " env:"GUM_INPUT_PROMPT"`
|
Prompt string `help:"Prompt to display" default:"> " env:"GUM_INPUT_PROMPT"`
|
||||||
PromptStyle style.Styles `embed:"" prefix:"prompt." envprefix:"GUM_INPUT_PROMPT_"`
|
PromptStyle style.Styles `embed:"" prefix:"prompt." envprefix:"GUM_INPUT_PROMPT_"`
|
||||||
PlaceholderStyle style.Styles `embed:"" prefix:"placeholder." envprefix:"GUM_INPUT_PLACEHOLDER_"`
|
PlaceholderStyle style.Styles `embed:"" prefix:"placeholder." set:"defaultForeground=240" envprefix:"GUM_INPUT_PLACEHOLDER_"`
|
||||||
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" envprefix:"GUM_INPUT_CURSOR_"`
|
CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" envprefix:"GUM_INPUT_CURSOR_"`
|
||||||
CursorMode string `prefix:"cursor." name:"mode" help:"Cursor mode" default:"blink" enum:"blink,hide,static" env:"GUM_INPUT_CURSOR_MODE"`
|
CursorMode string `prefix:"cursor." name:"mode" help:"Cursor mode" default:"blink" enum:"blink,hide,static" env:"GUM_INPUT_CURSOR_MODE"`
|
||||||
Value string `help:"Initial value (can also be passed via stdin)" default:""`
|
Value string `help:"Initial value (can also be passed via stdin)" default:""`
|
||||||
|
|
Loading…
Reference in a new issue