mirror of
https://github.com/Jguer/yay
synced 2024-10-05 23:59:13 +00:00
chore(alpm): use text.getinput for ialpm
This commit is contained in:
parent
9eb73899fe
commit
57a9630054
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue