Fixes --noconfirm. Changes default build location to ~/.cache/yay/

This commit is contained in:
Jguer 2018-02-07 11:18:19 +00:00
parent fb8297881f
commit c0901ff86b
2 changed files with 10 additions and 6 deletions

9
cmd.go
View file

@ -665,6 +665,10 @@ func passToPacman(args *arguments) error {
argArr = append(argArr, "pacman")
argArr = append(argArr, cmdArgs.formatGlobals()...)
argArr = append(argArr, args.formatArgs()...)
if config.NoConfirm {
argArr = append(argArr, "--noconfirm")
}
argArr = append(argArr, args.formatTargets()...)
cmd = exec.Command(argArr[0], argArr[1:]...)
@ -676,6 +680,11 @@ func passToPacman(args *arguments) error {
// passToMakepkg outsources execution to makepkg binary without modifications.
func passToMakepkg(dir string, args ...string) (err error) {
if config.NoConfirm {
args = append(args)
}
cmd := exec.Command(config.MakepkgBin, args...)
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
cmd.Dir = dir

View file

@ -5,7 +5,6 @@ import (
"fmt"
"os"
"os/exec"
"os/user"
alpm "github.com/jguer/go-alpm"
)
@ -103,11 +102,7 @@ func (config *Configuration) saveConfig() error {
}
func defaultSettings(config *Configuration) {
u, err := user.Current()
if err != nil {
panic(err)
}
config.BuildDir = fmt.Sprintf("/tmp/yaytmp-%s/", u.Uid)
config.BuildDir = fmt.Sprintf("%s/.cache/yay/", os.Getenv("HOME"))
config.CleanAfter = false
config.Editor = ""
config.Devel = false