瀏覽代碼

Merge pull request #215 from Morganamilo/mflags

Add --mflags option to pass args to makepkg
Morgana 7 年之前
父節點
當前提交
4088d5d856
共有 4 個文件被更改,包括 28 次插入8 次删除
  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
     --redownloadall      Always download pkgbuilds of all AUR packages
     --noredownload       Skip pkgbuild download if in cache and up to date
+    --mflags             Pass arguments to makepkg
 
 Print specific options:
     -c --complete        Used for completions
@@ -288,14 +289,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 +347,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 +375,8 @@ func handleConfig(option string) bool {
 		config.ReDownload = "all"
 	case "noredownload":
 		config.ReDownload = "no"
+	case "mflags":
+		config.MFlags = value
 	default:
 		return false
 	}
@@ -727,6 +730,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 - 0
config.go

@@ -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 - 0
parser.go

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

+ 11 - 3
yay.8

@@ -1,5 +1,5 @@
 /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
 .ad l
 .SH "NAME"
@@ -173,6 +173,14 @@ in cache\&.
 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\&.
 .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"
 .PP
 yay \fIfoo\fR
@@ -200,9 +208,9 @@ yay -Si \fIfoo\fR
 Gets information about package \fIfoo\fR from the repos or the \fBAUR\fR\&.
 .RE
 .PP
-yay -S \fIfoo\fR
+yay -S \fIfoo\fR --mflags "--skipchecksums --skippgpcheck"
 .RS 4
-Installs package \fIfoo\fR from the repos or the \fBAUR\fR\&.
+Installs \fIfoo\fR while skipping checksums and pgp checks\&.
 .RE
 .PP
 yay --devel --save