From c091460d8c6fab05089c926e1bf2954412b2525c Mon Sep 17 00:00:00 2001 From: morganamilo Date: Fri, 16 Mar 2018 00:18:13 +0000 Subject: [PATCH] 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. --- callbacks.go | 12 ++++++++++++ cmd.go | 2 ++ install.go | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 callbacks.go diff --git a/callbacks.go b/callbacks.go new file mode 100644 index 00000000..2973d804 --- /dev/null +++ b/callbacks.go @@ -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) + } +} diff --git a/cmd.go b/cmd.go index ef46e33e..02b37770 100644 --- a/cmd.go +++ b/cmd.go @@ -223,6 +223,8 @@ func initAlpm() (err error) { return } + alpmHandle.SetQuestionCallback(QuestionCallback) + return } diff --git a/install.go b/install.go index 6c273dcb..3945bcfc 100644 --- a/install.go +++ b/install.go @@ -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