diff --git a/example/simple/main.go b/example/simple/main.go index bec1050..6ae6ad0 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -8,6 +8,10 @@ func main() { tui.Start() defer tui.Stop() + pwd := tui.GetPassword("Password: ") + tui.PrintString("Got %s", pwd) + tui.GetString("...") + c := tui.GetMenu( "Menu", "Some long or short text.", diff --git a/input.go b/input.go index 01ee162..fb8dbeb 100644 --- a/input.go +++ b/input.go @@ -10,6 +10,12 @@ func GetString(prompt string) string { return s } +func GetPassword(prompt string) string { + s, err := t.ReadPassword(prompt) + must(err) + return s +} + func GetInt(prompt string) int { for { s := GetString(prompt)