Browse Source

Merge pull request #215 from Morganamilo/mflags

Add --mflags option to pass args to makepkg
Morgana 7 years ago
parent
commit
4088d5d856
4 changed files with 28 additions and 8 deletions
  1. 11 5
      cmd.go
  2. 2 0
      config.go
  3. 4 0
      parser.go
  4. 11 3
      yay.8

+ 11 - 5
cmd.go

@@ -52,6 +52,7 @@ Permanent configuration options:
     --redownload         Always download pkgbuilds of targets
     --redownload         Always download pkgbuilds of targets
     --redownloadall      Always download pkgbuilds of all AUR packages
     --redownloadall      Always download pkgbuilds of all AUR packages
     --noredownload       Skip pkgbuild download if in cache and up to date
     --noredownload       Skip pkgbuild download if in cache and up to date
+    --mflags             Pass arguments to makepkg
 
 
 Print specific options:
 Print specific options:
     -c --complete        Used for completions
     -c --complete        Used for completions
@@ -288,14 +289,14 @@ func updateSudo() {
 }
 }
 
 
 func handleCmd() (err error) {
 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)
 			cmdArgs.delArg(option)
 		}
 		}
 	}
 	}
 
 
-	for option := range cmdArgs.globals {
-		if handleConfig(option) {
+	for option, value := range cmdArgs.globals {
+		if handleConfig(option, value) {
 			cmdArgs.delArg(option)
 			cmdArgs.delArg(option)
 		}
 		}
 	}
 	}
@@ -346,7 +347,7 @@ func handleCmd() (err error) {
 //my current plan is to have yay specific operations in its own operator
 //my current plan is to have yay specific operations in its own operator
 //e.g. yay -Y --gendb
 //e.g. yay -Y --gendb
 //e.g yay -Yg
 //e.g yay -Yg
-func handleConfig(option string) bool {
+func handleConfig(option, value string) bool {
 	switch option {
 	switch option {
 	case "save":
 	case "save":
 		shouldSaveConfig = true
 		shouldSaveConfig = true
@@ -374,6 +375,8 @@ func handleConfig(option string) bool {
 		config.ReDownload = "all"
 		config.ReDownload = "all"
 	case "noredownload":
 	case "noredownload":
 		config.ReDownload = "no"
 		config.ReDownload = "no"
+	case "mflags":
+		config.MFlags = value
 	default:
 	default:
 		return false
 		return false
 	}
 	}
@@ -727,6 +730,9 @@ func passToMakepkg(dir string, args ...string) (err error) {
 		args = append(args)
 		args = append(args)
 	}
 	}
 
 
+	mflags := strings.Fields(config.MFlags)
+	args = append(args, mflags...)
+
 	cmd := exec.Command(config.MakepkgBin, args...)
 	cmd := exec.Command(config.MakepkgBin, args...)
 	cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
 	cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
 	cmd.Dir = dir
 	cmd.Dir = dir

+ 2 - 0
config.go

@@ -33,6 +33,7 @@ type Configuration struct {
 	TarBin        string `json:"tarbin"`
 	TarBin        string `json:"tarbin"`
 	ReDownload    string `json:"redownload"`
 	ReDownload    string `json:"redownload"`
 	GitBin        string `json:"gitbin"`
 	GitBin        string `json:"gitbin"`
+	MFlags        string `json:"mflags"`
 	RequestSplitN int    `json:"requestsplitn"`
 	RequestSplitN int    `json:"requestsplitn"`
 	SearchMode    int    `json:"-"`
 	SearchMode    int    `json:"-"`
 	SortMode      int    `json:"sortmode"`
 	SortMode      int    `json:"sortmode"`
@@ -124,6 +125,7 @@ func defaultSettings(config *Configuration) {
 	config.NoConfirm = false
 	config.NoConfirm = false
 	config.PacmanBin = "pacman"
 	config.PacmanBin = "pacman"
 	config.PacmanConf = "/etc/pacman.conf"
 	config.PacmanConf = "/etc/pacman.conf"
+	config.MFlags = ""
 	config.SortMode = BottomUp
 	config.SortMode = BottomUp
 	config.SudoLoop = false
 	config.SudoLoop = false
 	config.TarBin = "bsdtar"
 	config.TarBin = "bsdtar"

+ 4 - 0
parser.go

@@ -408,6 +408,10 @@ func hasParam(arg string) bool {
 		return true
 		return true
 	case "color":
 	case "color":
 		return true
 		return true
+
+	//yay params
+	case "mflags":
+		return true
 	default:
 	default:
 		return false
 		return false
 	}
 	}

+ 11 - 3
yay.8

@@ -1,5 +1,5 @@
 /n'\" t
 /n'\" t
-.TH "YAY" "8" "2018-02-29" "Yay v3\&.411+" "Yay Manual"
+.TH "YAY" "8" "2018-02-29" "Yay v3\&.460+" "Yay Manual"
 .nh
 .nh
 .ad l
 .ad l
 .SH "NAME"
 .SH "NAME"
@@ -173,6 +173,14 @@ in cache\&.
 When downloading pkgbuilds if the pkgbuild is found in cache and is equal or
 When downloading pkgbuilds if the pkgbuild is found in cache and is equal or
 newer than the AUR's version use that instead of downloading a new one\&.
 newer than the AUR's version use that instead of downloading a new one\&.
 .RE
 .RE
+.PP
+\fB\-\-mflags\fR
+.RS 4
+Passes arguments to makepkg\&. These flags get passed to every instance where
+makepkg is called by Yay. Arguments are split on whitespace before being
+passed to makepkg. Multiple arguments may be passed by suplying a space
+seperated list that is quoted by the shell.
+.RE
 .SH "EXAMPLES"
 .SH "EXAMPLES"
 .PP
 .PP
 yay \fIfoo\fR
 yay \fIfoo\fR
@@ -200,9 +208,9 @@ yay -Si \fIfoo\fR
 Gets information about package \fIfoo\fR from the repos or the \fBAUR\fR\&.
 Gets information about package \fIfoo\fR from the repos or the \fBAUR\fR\&.
 .RE
 .RE
 .PP
 .PP
-yay -S \fIfoo\fR
+yay -S \fIfoo\fR --mflags "--skipchecksums --skippgpcheck"
 .RS 4
 .RS 4
-Installs package \fIfoo\fR from the repos or the \fBAUR\fR\&.
+Installs \fIfoo\fR while skipping checksums and pgp checks\&.
 .RE
 .RE
 .PP
 .PP
 yay --devel --save
 yay --devel --save