diff --git a/prompt.go b/prompt.go index 0ec64b0..8e35123 100644 --- a/prompt.go +++ b/prompt.go @@ -33,6 +33,9 @@ type Prompt struct { // allows hiding private information like passwords. Mask rune + // HideEntered sets whether to hide the text after the user has pressed enter. + HideEntered bool + // Templates can be used to customize the prompt output. If nil is passed, the // default templates are used. See the PromptTemplates docs for more info. Templates *PromptTemplates @@ -234,9 +237,14 @@ func (p *Prompt) Run() (string, error) { } } - sb.Reset() - sb.Write(prompt) - sb.Flush() + if p.HideEntered { + clearScreen(sb) + } else { + sb.Reset() + sb.Write(prompt) + sb.Flush() + } + rl.Write([]byte(showCursor)) rl.Close()