mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 09:07:21 +01:00
Merge pull request #504 from Morganamilo/noask
Remove default usage of --ask
This commit is contained in:
commit
77a5cf5c69
4
cmd.go
4
cmd.go
@ -341,6 +341,10 @@ func handleConfig(option, value string) bool {
|
||||
config.EditMenu = true
|
||||
case "noeditmenu":
|
||||
config.EditMenu = false
|
||||
case "useask":
|
||||
config.UseAsk = true
|
||||
case "nouseask":
|
||||
config.UseAsk = false
|
||||
case "a", "aur":
|
||||
mode = ModeAUR
|
||||
case "repo":
|
||||
|
@ -69,6 +69,7 @@ type Configuration struct {
|
||||
CleanMenu bool `json:"cleanmenu"`
|
||||
DiffMenu bool `json:"diffmenu"`
|
||||
EditMenu bool `json:"editmenu"`
|
||||
UseAsk bool `json:"useask"`
|
||||
}
|
||||
|
||||
var version = "7.885"
|
||||
@ -177,6 +178,7 @@ func defaultSettings(config *Configuration) {
|
||||
config.CleanMenu = true
|
||||
config.DiffMenu = true
|
||||
config.EditMenu = false
|
||||
config.UseAsk = false
|
||||
}
|
||||
|
||||
// Editor returns the preferred system editor.
|
||||
|
11
depCheck.go
11
depCheck.go
@ -124,7 +124,7 @@ func (dp *depPool) checkReverseConflicts(conflicts mapStringSet) {
|
||||
})
|
||||
}
|
||||
|
||||
func (dp *depPool) CheckConflicts() error {
|
||||
func (dp *depPool) CheckConflicts() (mapStringSet, error) {
|
||||
var wg sync.WaitGroup
|
||||
innerConflicts := make(mapStringSet)
|
||||
conflicts := make(mapStringSet)
|
||||
@ -159,12 +159,17 @@ func (dp *depPool) CheckConflicts() error {
|
||||
fmt.Println(str)
|
||||
}
|
||||
|
||||
return fmt.Errorf("Unresolvable package conflicts, aborting")
|
||||
return nil, fmt.Errorf("Unresolvable package conflicts, aborting")
|
||||
}
|
||||
|
||||
if len(conflicts) != 0 {
|
||||
fmt.Println()
|
||||
fmt.Println(bold(red(arrow)), bold("Package conflicts found:"))
|
||||
|
||||
if !config.UseAsk {
|
||||
fmt.Println(bold(red(arrow)), bold("You will have to confirm these when installing"))
|
||||
}
|
||||
|
||||
for name, pkgs := range conflicts {
|
||||
str := red(bold(smallArrow)) + " Installing " + cyan(name) + " will remove:"
|
||||
for pkg := range pkgs {
|
||||
@ -178,7 +183,7 @@ func (dp *depPool) CheckConflicts() error {
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
return nil
|
||||
return conflicts, nil
|
||||
}
|
||||
|
||||
type missing struct {
|
||||
|
34
install.go
34
install.go
@ -116,7 +116,7 @@ func install(parser *arguments) error {
|
||||
return fmt.Errorf(bold(red(arrow)) + " Refusing to install AUR Packages as root, Aborting.")
|
||||
}
|
||||
|
||||
err = dp.CheckConflicts()
|
||||
conflicts, err := dp.CheckConflicts()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -279,17 +279,12 @@ func install(parser *arguments) error {
|
||||
}
|
||||
}
|
||||
|
||||
//conflicts have been checked so answer y for them
|
||||
ask, _ := strconv.Atoi(cmdArgs.globals["ask"])
|
||||
uask := alpm.QuestionType(ask) | alpm.QuestionTypeConflictPkg
|
||||
cmdArgs.globals["ask"] = fmt.Sprint(uask)
|
||||
|
||||
err = downloadPkgBuildsSources(do.Aur, do.Bases, incompatible)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = buildInstallPkgBuilds(dp, do, srcinfosStale, parser, incompatible)
|
||||
err = buildInstallPkgBuilds(dp, do, srcinfosStale, parser, incompatible, conflicts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -745,7 +740,7 @@ func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, inco
|
||||
return
|
||||
}
|
||||
|
||||
func buildInstallPkgBuilds(dp *depPool, do *depOrder, srcinfos map[string]*gopkg.PKGBUILD, parser *arguments, incompatible stringSet) error {
|
||||
func buildInstallPkgBuilds(dp *depPool, do *depOrder, srcinfos map[string]*gopkg.PKGBUILD, parser *arguments, incompatible stringSet, conflicts mapStringSet) error {
|
||||
for _, pkg := range do.Aur {
|
||||
dir := filepath.Join(config.BuildDir, pkg.PackageBase)
|
||||
built := true
|
||||
@ -807,6 +802,7 @@ func buildInstallPkgBuilds(dp *depPool, do *depOrder, srcinfos map[string]*gopkg
|
||||
arguments.clearTargets()
|
||||
arguments.op = "U"
|
||||
arguments.delArg("confirm")
|
||||
arguments.delArg("noconfirm")
|
||||
arguments.delArg("c", "clean")
|
||||
arguments.delArg("q", "quiet")
|
||||
arguments.delArg("q", "quiet")
|
||||
@ -814,6 +810,26 @@ func buildInstallPkgBuilds(dp *depPool, do *depOrder, srcinfos map[string]*gopkg
|
||||
arguments.delArg("u", "sysupgrade")
|
||||
arguments.delArg("w", "downloadonly")
|
||||
|
||||
oldConfirm := config.NoConfirm
|
||||
|
||||
//conflicts have been checked so answer y for them
|
||||
if config.UseAsk {
|
||||
ask, _ := strconv.Atoi(cmdArgs.globals["ask"])
|
||||
uask := alpm.QuestionType(ask) | alpm.QuestionTypeConflictPkg
|
||||
cmdArgs.globals["ask"] = fmt.Sprint(uask)
|
||||
} else {
|
||||
conflict := false
|
||||
for _, split := range do.Bases[pkg.PackageBase] {
|
||||
if _, ok := conflicts[split.Name]; ok {
|
||||
conflict = true
|
||||
}
|
||||
}
|
||||
|
||||
if !conflict {
|
||||
config.NoConfirm = true
|
||||
}
|
||||
}
|
||||
|
||||
depArguments := makeArguments()
|
||||
depArguments.addArg("D", "asdeps")
|
||||
expArguments := makeArguments()
|
||||
@ -850,8 +866,6 @@ func buildInstallPkgBuilds(dp *depPool, do *depOrder, srcinfos map[string]*gopkg
|
||||
}
|
||||
}
|
||||
|
||||
oldConfirm := config.NoConfirm
|
||||
config.NoConfirm = true
|
||||
err = passToPacman(arguments)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user