Added GetPassword function.
parent
a510706310
commit
b84778e44c
|
@ -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.",
|
||||||
|
|
6
input.go
6
input.go
|
@ -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)
|
||||||
|
|
Reference in New Issue