envoid/internal/prompt/password.go
Sagi Dayan beac69aeb2
Some checks failed
ci/ci / Check for spelling errors (pull_request) Failing after 25s
ci/ci / Make sure build does not fail (pull_request) Has been skipped
ci/ci / notify-fail (pull_request) Successful in 15s
Added lint to the CI. formatted all code accordingly
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-16 23:13:21 +02:00

28 lines
303 B
Go

package prompt
import (
"fmt"
"os"
"syscall"
"golang.org/x/term"
)
func PasswordPrompt(label string) string {
var str string
for {
fmt.Fprint(os.Stderr, label+" ")
b, _ := term.ReadPassword(syscall.Stdin)
str = string(b)
if str != "" {
break
}
}
fmt.Println()
return str
}