Write username and password prompt to stderr
This commit is contained in:
parent
ddbfc6893a
commit
13c28408f9
@ -8,4 +8,3 @@ or LSF Served Fabulously
|
||||
- tests
|
||||
- webapi
|
||||
- wrap errors correctly. run cmd/lsf without an internet connection and get inspired by the standard libary
|
||||
- username/password prompt stderr
|
||||
|
@ -74,7 +74,7 @@ func sessionNeeded() {
|
||||
|
||||
func readUsername() (string, error) {
|
||||
var username string
|
||||
fmt.Print("Username: ")
|
||||
fmt.Fprint(os.Stderr, "Username: ")
|
||||
_, err := fmt.Scanf("%s", &username)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "could not read username")
|
||||
@ -84,12 +84,12 @@ func readUsername() (string, error) {
|
||||
|
||||
func readPassword() (string, error) {
|
||||
var password string
|
||||
fmt.Print("Password: ")
|
||||
fmt.Fprint(os.Stderr, "Password: ")
|
||||
b, err := terminal.ReadPassword(int(syscall.Stdin))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fmt.Print("\n")
|
||||
fmt.Fprint(os.Stderr, "\n")
|
||||
password = string(b)
|
||||
return password, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user