Support answerdiff to match answer{clean,edit}

This commit is contained in:
morganamilo 2018-06-11 19:13:40 +01:00
parent 0960f9a135
commit 01fa34093f
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
4 changed files with 22 additions and 8 deletions

4
cmd.go
View file

@ -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":

View file

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

View file

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

View file

@ -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":