fix(write): max height, max chars (#753)

This commit is contained in:
Carlos Alexandro Becker 2024-12-09 20:53:54 -03:00 committed by GitHub
commit 01892a027f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -28,6 +28,7 @@ func (o Options) Run() error {
a.Placeholder = o.Placeholder
a.ShowLineNumbers = o.ShowLineNumbers
a.CharLimit = o.CharLimit
a.MaxHeight = o.MaxLines
style := textarea.Style{
Base: o.BaseStyle.ToLipgloss(),

View file

@ -16,7 +16,8 @@ type Options struct {
ShowCursorLine bool `help:"Show cursor line" default:"false" env:"GUM_WRITE_SHOW_CURSOR_LINE"`
ShowLineNumbers bool `help:"Show line numbers" default:"false" env:"GUM_WRITE_SHOW_LINE_NUMBERS"`
Value string `help:"Initial value (can be passed via stdin)" default:"" env:"GUM_WRITE_VALUE"`
CharLimit int `help:"Maximum value length (0 for no limit)" default:"400"`
CharLimit int `help:"Maximum value length (0 for no limit)" default:"0"`
MaxLines int `help:"Maximum number of lines (0 for no limit)" default:"0"`
ShowHelp bool `help:"Show help key binds" negatable:"" default:"true" env:"GUM_WRITE_SHOW_HELP"`
CursorMode string `prefix:"cursor." name:"mode" help:"Cursor mode" default:"blink" enum:"blink,hide,static" env:"GUM_WRITE_CURSOR_MODE"`
Timeout time.Duration `help:"Timeout until choose returns selected element" default:"0s" env:"GUM_WRITE_TIMEOUT"`