Sha256: 3c6a121279a8084a7ec7ce6fadd067a6d953507be039b68eddbca1ec5b876836
Contents?: true
Size: 502 Bytes
Versions: 16
Compression:
Stored size: 502 Bytes
Contents
package keyring import ( "fmt" "os" "golang.org/x/term" ) // PromptFunc is a function used to prompt the user for a password. type PromptFunc func(string) (string, error) func TerminalPrompt(prompt string) (string, error) { fmt.Printf("%s: ", prompt) b, err := term.ReadPassword(int(os.Stdin.Fd())) if err != nil { return "", err } fmt.Println() return string(b), nil } func FixedStringPrompt(value string) PromptFunc { return func(_ string) (string, error) { return value, nil } }
Version data entries
16 entries across 16 versions & 1 rubygems