fix: allow piped Forgejo credentials
This commit is contained in:
parent
a62799d531
commit
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