mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 13:22:40 +08:00
Add support to reading password from stdin
This commit is contained in:
parent
9bd12bc2e5
commit
7c68fec718
13
auth.go
13
auth.go
@ -2,7 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/reconquest/karma-go"
|
||||
@ -47,6 +49,17 @@ func GetCredentials(
|
||||
}
|
||||
}
|
||||
|
||||
if password == "-" {
|
||||
b, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return nil, karma.Format(
|
||||
err,
|
||||
"unable to read password from stdin",
|
||||
)
|
||||
}
|
||||
password = string(b)
|
||||
}
|
||||
|
||||
url, err := url.Parse(targetURL)
|
||||
if err != nil {
|
||||
return nil, karma.Format(
|
||||
|
Loading…
x
Reference in New Issue
Block a user