mirror of
https://github.com/Jguer/yay.git
synced 2025-10-09 00:07:14 -04:00
Merge pull request #461 from Morganamilo/repoaur
Support --aur/--repo for -Ss and -Y
This commit is contained in:
commit
b56afaaee3
52
cmd.go
52
cmd.go
@ -441,23 +441,43 @@ func handleRemove() (err error) {
|
|||||||
|
|
||||||
// NumberMenu presents a CLI for selecting packages to install.
|
// NumberMenu presents a CLI for selecting packages to install.
|
||||||
func numberMenu(pkgS []string, flags []string) (err error) {
|
func numberMenu(pkgS []string, flags []string) (err error) {
|
||||||
aurQ, aurErr := narrowSearch(pkgS, true)
|
pkgS = removeInvalidTargets(pkgS)
|
||||||
numaq := len(aurQ)
|
var aurErr error
|
||||||
repoQ, numpq, err := queryRepo(pkgS)
|
var repoErr error
|
||||||
if err != nil {
|
var aq aurQuery
|
||||||
return
|
var pq repoQuery
|
||||||
|
var lenaq int
|
||||||
|
var lenpq int
|
||||||
|
|
||||||
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
|
aq, aurErr = narrowSearch(pkgS, true)
|
||||||
|
lenaq = len(aq)
|
||||||
|
}
|
||||||
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
|
pq, lenpq, repoErr = queryRepo(pkgS)
|
||||||
|
if repoErr != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if numpq == 0 && numaq == 0 {
|
if lenpq == 0 && lenaq == 0 {
|
||||||
return fmt.Errorf("no packages match search")
|
return fmt.Errorf("No packages match search")
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SortMode == BottomUp {
|
if config.SortMode == BottomUp {
|
||||||
aurQ.printSearch(numpq + 1)
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
repoQ.printSearch()
|
aq.printSearch(lenpq + 1)
|
||||||
|
}
|
||||||
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
|
pq.printSearch()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
repoQ.printSearch()
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
aurQ.printSearch(numpq + 1)
|
pq.printSearch()
|
||||||
|
}
|
||||||
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
|
aq.printSearch(lenpq + 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if aurErr != nil {
|
if aurErr != nil {
|
||||||
@ -484,8 +504,8 @@ func numberMenu(pkgS []string, flags []string) (err error) {
|
|||||||
|
|
||||||
isInclude := len(exclude) == 0 && len(otherExclude) == 0
|
isInclude := len(exclude) == 0 && len(otherExclude) == 0
|
||||||
|
|
||||||
for i, pkg := range repoQ {
|
for i, pkg := range pq {
|
||||||
target := len(repoQ) - i
|
target := len(pq) - i
|
||||||
if config.SortMode == TopDown {
|
if config.SortMode == TopDown {
|
||||||
target = i + 1
|
target = i + 1
|
||||||
}
|
}
|
||||||
@ -498,10 +518,10 @@ func numberMenu(pkgS []string, flags []string) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, pkg := range aurQ {
|
for i, pkg := range aq {
|
||||||
target := len(aurQ) - i + len(repoQ)
|
target := len(aq) - i + len(pq)
|
||||||
if config.SortMode == TopDown {
|
if config.SortMode == TopDown {
|
||||||
target = i + 1 + len(repoQ)
|
target = i + 1 + len(pq)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isInclude && include.get(target) {
|
if isInclude && include.get(target) {
|
||||||
|
24
query.go
24
query.go
@ -159,19 +159,37 @@ func narrowSearch(pkgS []string, sortS bool) (aurQuery, error) {
|
|||||||
|
|
||||||
// SyncSearch presents a query to the local repos and to the AUR.
|
// SyncSearch presents a query to the local repos and to the AUR.
|
||||||
func syncSearch(pkgS []string) (err error) {
|
func syncSearch(pkgS []string) (err error) {
|
||||||
aq, aurErr := narrowSearch(pkgS, true)
|
pkgS = removeInvalidTargets(pkgS)
|
||||||
pq, _, err := queryRepo(pkgS)
|
var aurErr error
|
||||||
if err != nil {
|
var repoErr error
|
||||||
|
var aq aurQuery
|
||||||
|
var pq repoQuery
|
||||||
|
|
||||||
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
|
aq, aurErr = narrowSearch(pkgS, true)
|
||||||
|
}
|
||||||
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
|
pq, _, repoErr = queryRepo(pkgS)
|
||||||
|
if repoErr != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if config.SortMode == BottomUp {
|
if config.SortMode == BottomUp {
|
||||||
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
aq.printSearch(1)
|
aq.printSearch(1)
|
||||||
|
}
|
||||||
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
pq.printSearch()
|
pq.printSearch()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if mode == ModeRepo || mode == ModeAny {
|
||||||
pq.printSearch()
|
pq.printSearch()
|
||||||
|
}
|
||||||
|
if mode == ModeAUR || mode == ModeAny {
|
||||||
aq.printSearch(1)
|
aq.printSearch(1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if aurErr != nil {
|
if aurErr != nil {
|
||||||
fmt.Printf("Error during AUR search: %s\n", aurErr)
|
fmt.Printf("Error during AUR search: %s\n", aurErr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user