Use a question callback for ignorepkg

The callback is set to allways silently say yes, When passing to pacman
for the intall pacman will then ask the question giving the user
a chance to answer.
This commit is contained in:
morganamilo 2018-03-16 00:18:13 +00:00
parent e0b8c92433
commit c091460d8c
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
3 changed files with 15 additions and 1 deletions

12
callbacks.go Normal file
View file

@ -0,0 +1,12 @@
package main
import (
alpm "github.com/jguer/go-alpm"
)
func QuestionCallback(question alpm.QuestionAny) {
q, err := question.QuestionInstallIgnorepkg()
if err == nil {
q.SetInstall(true)
}
}

2
cmd.go
View file

@ -223,6 +223,8 @@ func initAlpm() (err error) {
return
}
alpmHandle.SetQuestionCallback(QuestionCallback)
return
}

View file

@ -184,7 +184,7 @@ func install(parser *arguments) error {
//conflicts have been checked so answer y for them
ask, _ := strconv.Atoi(cmdArgs.globals["ask"])
uask := alpm.Question(ask) | alpm.QuestionConflictPkg
uask := alpm.QuestionType(ask) | alpm.QuestionTypeConflictPkg
cmdArgs.globals["ask"] = fmt.Sprint(uask)
//this downloads the package build sources but also causes