Forráskód Böngészése

feat(search): add optional setting that formats each search result on a single line

Matt Alexander 3 éve
szülő
commit
673f077e7f
8 módosított fájl, 24 hozzáadás és 1 törlés
  1. 2 0
      cmd.go
  2. 1 1
      completions/bash
  3. 2 0
      completions/fish
  4. 2 0
      completions/zsh
  5. 10 0
      doc/yay.8
  6. 4 0
      pkg/settings/args.go
  7. 1 0
      pkg/settings/config.go
  8. 2 0
      pkg/settings/parser/parser.go

+ 2 - 0
cmd.go

@@ -119,6 +119,8 @@ Permanent configuration options:
     --nocombinedupgrade   Perform the repo upgrade and AUR upgrade separately
     --batchinstall        Build multiple AUR packages then install them together
     --nobatchinstall      Build and install each AUR package one by one
+    --singlelineresults   List each search result on its own line
+    --doublelineresults   List each search result on two lines, like pacman
 
     --sudo                <file>  sudo command to use
     --sudoflags           <flags> Pass arguments to sudo

+ 1 - 1
completions/bash

@@ -76,7 +76,7 @@ _yay() {
           nocleanmenu nodiffmenu noupgrademenu provides noprovides pgpfetch nopgpfetch
           useask nouseask combinedupgrade nocombinedupgrade aur repo makepkgconf
           nomakepkgconf askremovemake removemake noremovemake completioninterval aururl
-          searchby batchinstall nobatchinstall'
+          searchby batchinstall nobatchinstall singlelineresults doublelineresults'
     'b d h q r v')
   yays=('clean gendb' 'c')
   show=('complete defaultconfig currentconfig stats news' 'c d g s w')

+ 2 - 0
completions/fish

@@ -237,6 +237,8 @@ complete -c $progname -n "not $noopt" -l combinedupgrade -d 'Refresh then perfor
 complete -c $progname -n "not $noopt" -l nocombinedupgrade -d 'Perform the repo upgrade and AUR upgrade separately' -f
 complete -c $progname -n "not $noopt" -l batchinstall -d 'Build multiple AUR packages then install them together' -f
 complete -c $progname -n "not $noopt" -l nobatchinstall -d 'Build and install each AUR package one by one' -f
+complete -c $progname -n "not $noopt" -l singlelineresults -d 'List each search result on its own line' -f
+complete -c $progname -n "not $noopt" -l doublelineresults -d 'List each search result on two lines, like pacman' -f
 complete -c $progname -n "not $noopt" -l rebuild -d 'Always build target packages' -f
 complete -c $progname -n "not $noopt" -l rebuildall -d 'Always build all AUR packages' -f
 complete -c $progname -n "not $noopt" -l rebuildtree -d 'Always build all AUR packages even if installed' -f

+ 2 - 0
completions/zsh

@@ -108,6 +108,8 @@ _pacman_opts_common=(
 	'--sortby[Sort AUR results by a specific field during search]'
 	'--batchinstall[Build multiple AUR packages then install them together]'
 	'--nobatchinstall[Build and install each AUR package one by one]'
+	'--singlelineresults[List each search result on its own line]'
+	'--doublelineresults[List each search result on two lines, like pacman]'
 )
 
 # options for passing to _arguments: options for --upgrade commands

+ 10 - 0
doc/yay.8

@@ -450,6 +450,16 @@ another package, install all the packages in the install queue.
 Always install AUR packages immediately after building them.
 
 .TP
+.B \-\-singlelineresults
+Override pacman's usual double-line search result format and list each result
+on its own line.
+
+.TP
+.B \-\-doublelineresults
+Follow pacman's double-line search result format and list each result using
+two lines.
+
+.TP
 .B \-\-rebuild
 Always build target packages even when a copy is available in cache.
 

+ 4 - 0
pkg/settings/args.go

@@ -179,6 +179,10 @@ func (c *Configuration) handleOption(option, value string) bool {
 		c.RemoveMake = "no"
 	case "askremovemake":
 		c.RemoveMake = "ask"
+	case "singlelineresults":
+		c.SingleLineResults = true
+	case "doublelineresults":
+		c.SingleLineResults = false
 	default:
 		return false
 	}

+ 1 - 0
pkg/settings/config.go

@@ -75,6 +75,7 @@ type Configuration struct {
 	CombinedUpgrade    bool     `json:"combinedupgrade"`
 	UseAsk             bool     `json:"useask"`
 	BatchInstall       bool     `json:"batchinstall"`
+	SingleLineResults  bool     `json:"singlelineresults"`
 	Runtime            *Runtime `json:"-"`
 }
 

+ 2 - 0
pkg/settings/parser/parser.go

@@ -444,6 +444,8 @@ func isArg(arg string) bool {
 	case "news":
 	case "gendb":
 	case "currentconfig":
+	case "singlelineresults":
+	case "doublelineresults":
 	default:
 		return false
 	}