Compare commits
2 commits
c9a8e38914
...
7e4d50b776
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e4d50b776 | ||
|
|
29c7180259 |
|
|
@ -167,6 +167,13 @@ func promptHiddenRequired(prompt string) (string, error) {
|
|||
|
||||
func promptHiddenOptional(prompt string) (string, error) {
|
||||
fmt.Printf("%s: ", prompt)
|
||||
if !term.IsTerminal(int(syscall.Stdin)) {
|
||||
value, err := bufio.NewReader(os.Stdin).ReadString('\n')
|
||||
if err != nil && len(value) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
return strings.TrimSpace(value), nil
|
||||
}
|
||||
value, err := term.ReadPassword(int(syscall.Stdin))
|
||||
fmt.Println()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue