Browse Source

Added GetPassword function.

master
jdl 2 years ago
parent
commit
b84778e44c
2 changed files with 10 additions and 0 deletions
  1. +4
    -0
      example/simple/main.go
  2. +6
    -0
      input.go

+ 4
- 0
example/simple/main.go View File

@ -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.",


+ 6
- 0
input.go View File

@ -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)


Loading…
Cancel
Save