1
0
mirror of https://github.com/Jguer/yay synced 2024-07-08 04:16:16 +00:00

chore(alpm): use text.getinput for ialpm

This commit is contained in:
jguer 2021-10-16 22:42:56 +02:00 committed by J Guerreiro
parent 9eb73899fe
commit 57a9630054

View File

@ -1,7 +1,6 @@
package ialpm
import (
"bufio"
"errors"
"fmt"
"os"
@ -191,28 +190,19 @@ func (ae *AlpmExecutor) questionCallback() func(question alpm.QuestionAny) {
break
}
reader := bufio.NewReader(os.Stdin)
numberBuf, overflow, err := reader.ReadLine()
numberBuf, err := text.GetInput("", false)
if err != nil {
text.Errorln(err)
break
}
if overflow {
text.Errorln(gotext.Get(" Input too long"))
continue
}
if string(numberBuf) == "" {
if numberBuf == "" {
break
}
num, err := strconv.Atoi(string(numberBuf))
num, err := strconv.Atoi(numberBuf)
if err != nil {
text.Errorln(gotext.Get("invalid number: %s", string(numberBuf)))
text.Errorln(gotext.Get("invalid number: %s", numberBuf))
continue
}