Add --mflags option to pass args to makepkg

This commit is contained in:
morganamilo 2018-03-07 17:12:30 +00:00
parent c89941bf83
commit cee0d74643
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
3 changed files with 16 additions and 5 deletions

15
cmd.go
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

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"

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
}