diff --git a/input/command.go b/input/command.go index ec529b81a..0a3f8c4ce 100644 --- a/input/command.go +++ b/input/command.go @@ -31,6 +31,11 @@ func (o Options) Run() error { i.PromptStyle = o.PromptStyle.ToLipgloss() i.CursorStyle = o.CursorStyle.ToLipgloss() + if o.Password { + i.EchoMode = textinput.EchoPassword + i.EchoCharacter = '•' + } + p := tea.NewProgram(model{i}, tea.WithOutput(os.Stderr)) m, err := p.StartReturningModel() fmt.Println(m.(model).textinput.Value()) diff --git a/input/options.go b/input/options.go index 988112485..5d3d50fc1 100644 --- a/input/options.go +++ b/input/options.go @@ -10,4 +10,5 @@ type Options struct { CursorStyle style.Styles `embed:"" prefix:"cursor." set:"defaultForeground=212" set:"name=cursor"` Value string `help:"Initial value (can also be passed via stdin)" default:""` Width int `help:"Input width" default:"40"` + Password bool `help:"Mask input characters" default:"false"` }