Added GetPassword function.

master
jdl 2021-03-24 12:24:17 +01:00
parent a510706310
commit b84778e44c
2 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,10 @@ func main() {
tui.Start() tui.Start()
defer tui.Stop() defer tui.Stop()
pwd := tui.GetPassword("Password: ")
tui.PrintString("Got %s", pwd)
tui.GetString("...")
c := tui.GetMenu( c := tui.GetMenu(
"Menu", "Menu",
"Some long or short text.", "Some long or short text.",

View File

@ -10,6 +10,12 @@ func GetString(prompt string) string {
return s return s
} }
func GetPassword(prompt string) string {
s, err := t.ReadPassword(prompt)
must(err)
return s
}
func GetInt(prompt string) int { func GetInt(prompt string) int {
for { for {
s := GetString(prompt) s := GetString(prompt)