Parcourir la source

chore(alpm): use text.getinput for ialpm

jguer il y a 3 ans
Parent
commit
57a9630054
1 fichiers modifiés avec 4 ajouts et 14 suppressions
  1. 4 14
      pkg/db/ialpm/alpm.go

+ 4 - 14
pkg/db/ialpm/alpm.go

@@ -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
 			}