Add --mflags option to pass args to makepkg

This commit is contained in:
morganamilo committed 2018-03-07 23:18:00 +00:00
1 parent c89941bf83
commit cee0d74643
3 files changed
+16 -5

No files matched your search

+10 -5
View File
@@ -288,14 +288,14 @@ func updateSudo() {
}
func handleCmd() (err error) {
for option := range cmdArgs.options {
if handleConfig(option) {
for option, value := range cmdArgs.options {
if handleConfig(option, value) {
cmdArgs.delArg(option)
}
}
for option := range cmdArgs.globals {
if handleConfig(option) {
for option, value := range cmdArgs.globals {
if handleConfig(option, value) {
cmdArgs.delArg(option)
}
}
@@ -346,7 +346,7 @@ func handleCmd() (err error) {
//my current plan is to have yay specific operations in its own operator
//e.g. yay -Y --gendb
//e.g yay -Yg
func handleConfig(option string) bool {
func handleConfig(option, value string) bool {
switch option {
case "save":
shouldSaveConfig = true
@@ -374,6 +374,8 @@ func handleConfig(option string) bool {
config.ReDownload = "all"
case "noredownload":
config.ReDownload = "no"
case "mflags":
config.MFlags = value
default:
return false
}
@@ -727,6 +729,9 @@ func passToMakepkg(dir string, args ...string) (err error) {
args = append(args)
}
mflags := strings.Fields(config.MFlags)
args = append(args, mflags...)
cmd := exec.Command(config.MakepkgBin, args...)
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
cmd.Dir = dir
+2
View File
@@ -33,6 +33,7 @@ type Configuration struct {
TarBin string `json:"tarbin"`
ReDownload string `json:"redownload"`
GitBin string `json:"gitbin"`
MFlags string `json:"mflags"`
RequestSplitN int `json:"requestsplitn"`
SearchMode int `json:"-"`
SortMode int `json:"sortmode"`
@@ -124,6 +125,7 @@ func defaultSettings(config *Configuration) {
config.NoConfirm = false
config.PacmanBin = "pacman"
config.PacmanConf = "/etc/pacman.conf"
config.MFlags = ""
config.SortMode = BottomUp
config.SudoLoop = false
config.TarBin = "bsdtar"
+4
View File
@@ -408,6 +408,10 @@ func hasParam(arg string) bool {
return true
case "color":
return true
//yay params
case "mflags":
return true
default:
return false
}