Skip to content
Myr

options.go

This file

Path

input/options.go

27 lines · 1.9 KiB · Go

Last changed by

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

History of this file

Take it

1package input23import (4	"time"56	"charm.land/gum/v2/style"7)89// Options are the customization options for the input.10type Options struct {11	Placeholder      string        `help:"Placeholder value" default:"Type something..." env:"GUM_INPUT_PLACEHOLDER"`12	Prompt           string        `help:"Prompt to display" default:"> " env:"GUM_INPUT_PROMPT"`13	PromptStyle      style.Styles  `embed:"" prefix:"prompt." envprefix:"GUM_INPUT_PROMPT_"`14	PlaceholderStyle style.Styles  `embed:"" prefix:"placeholder." set:"defaultForeground=240" envprefix:"GUM_INPUT_PLACEHOLDER_"`15	CursorStyle      style.Styles  `embed:"" prefix:"cursor." set:"defaultForeground=212" envprefix:"GUM_INPUT_CURSOR_"`16	CursorMode       string        `prefix:"cursor." name:"mode" help:"Cursor mode" default:"blink" enum:"blink,hide,static" env:"GUM_INPUT_CURSOR_MODE"`17	Value            string        `help:"Initial value (can also be passed via stdin)" default:""`18	CharLimit        int           `help:"Maximum value length (0 for no limit)" default:"400"`19	Width            int           `help:"Input width (0 for terminal width)" default:"0" env:"GUM_INPUT_WIDTH"`20	Password         bool          `help:"Mask input characters" default:"false"`21	ShowHelp         bool          `help:"Show help keybinds" default:"true" negatable:"" env:"GUM_INPUT_SHOW_HELP"`22	Header           string        `help:"Header value" default:"" env:"GUM_INPUT_HEADER"`23	HeaderStyle      style.Styles  `embed:"" prefix:"header." set:"defaultForeground=240" envprefix:"GUM_INPUT_HEADER_"`24	Timeout          time.Duration `help:"Timeout until input aborts" default:"0s" env:"GUM_INPUT_TIMEOUT"`25	StripANSI        bool          `help:"Strip ANSI sequences when reading from STDIN" default:"true" negatable:"" env:"GUM_INPUT_STRIP_ANSI"`26	Padding          string        `help:"Padding" default:"${defaultPadding}" group:"Style Flags" env:"GUM_INPUT_PADDING"`27}