From 01fa34093f18c1f0d3b8c6a3178264428a9baa0c Mon Sep 17 00:00:00 2001 From: morganamilo Date: Mon, 11 Jun 2018 19:13:40 +0100 Subject: [PATCH] Support answerdiff to match answer{clean,edit} --- cmd.go | 4 ++++ config.go | 2 ++ install.go | 22 ++++++++++++++-------- parser.go | 2 ++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cmd.go b/cmd.go index a9f75fe5..083a6654 100644 --- a/cmd.go +++ b/cmd.go @@ -262,6 +262,10 @@ func handleConfig(option, value string) bool { config.AnswerClean = value case "noanswerclean": config.AnswerClean = "" + case "answerdiff": + config.AnswerDiff = value + case "noanswerdiff": + config.AnswerDiff = "" case "answeredit": config.AnswerEdit = value case "noansweredit": diff --git a/config.go b/config.go index bb66d6ea..4e50f32d 100644 --- a/config.go +++ b/config.go @@ -45,6 +45,7 @@ type Configuration struct { ReDownload string `json:"redownload"` ReBuild string `json:"rebuild"` AnswerClean string `json:"answerclean"` + AnswerDiff string `json:"answerdiff"` AnswerEdit string `json:"answeredit"` AnswerUpgrade string `json:"answerupgrade"` GitBin string `json:"gitbin"` @@ -167,6 +168,7 @@ func defaultSettings(config *Configuration) { config.ReDownload = "no" config.ReBuild = "no" config.AnswerClean = "" + config.AnswerDiff = "" config.AnswerEdit = "" config.AnswerUpgrade = "" config.GitClone = true diff --git a/install.go b/install.go index 99e3868a..cb8b0d42 100644 --- a/install.go +++ b/install.go @@ -477,19 +477,25 @@ func diffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stri func editDiffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet, diff bool) ([]*rpc.Pkg, error) { toEdit := make([]*rpc.Pkg, 0) + var editInput string + var err error + + fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")) if diff { fmt.Println(bold(green(arrow + " Diffs to show?"))) + fmt.Print(bold(green(arrow + " "))) + editInput, err = getInput(config.AnswerDiff) + if err != nil { + return nil, err + } } else { fmt.Println(bold(green(arrow + " PKGBUILDs to edit?"))) - } - fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")) - - fmt.Print(bold(green(arrow + " "))) - - editInput, err := getInput(config.AnswerEdit) - if err != nil { - return nil, err + fmt.Print(bold(green(arrow + " "))) + editInput, err = getInput(config.AnswerEdit) + if err != nil { + return nil, err + } } eInclude, eExclude, eOtherInclude, eOtherExclude := parseNumberMenu(editInput) diff --git a/parser.go b/parser.go index f2a64d80..8a2ce936 100644 --- a/parser.go +++ b/parser.go @@ -469,6 +469,8 @@ func hasParam(arg string) bool { return true case "answerclean": return true + case "answerdiff": + return true case "answeredit": return true case "answerupgrade":