Prompt for password input
This commit is contained in:
parent
7bd75ada56
commit
4bfaf12de7
1 changed files with 1 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
// ReadPassword reads a single line of text from the terminal withouth echoing it out.
|
// ReadPassword reads a single line of text from the terminal withouth echoing it out.
|
||||||
func ReadPassword() string {
|
func ReadPassword() string {
|
||||||
|
fmt.Println("Enter your password:")
|
||||||
raw, err := term.ReadPassword(int(os.Stdin.Fd()))
|
raw, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("could not reat password from the terminal: %s", err.Error()))
|
panic(fmt.Sprintf("could not reat password from the terminal: %s", err.Error()))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue