mirror of
https://github.com/Jguer/yay
synced 2024-10-02 22:33:47 +00:00
Support --aur/--repo for -Ss and -Y
This commit is contained in:
parent
ab317e52fe
commit
ced35af515
52
cmd.go
52
cmd.go
|
@ -441,23 +441,43 @@ func handleRemove() (err error) {
|
|||
|
||||
// NumberMenu presents a CLI for selecting packages to install.
|
||||
func numberMenu(pkgS []string, flags []string) (err error) {
|
||||
aurQ, aurErr := narrowSearch(pkgS, true)
|
||||
numaq := len(aurQ)
|
||||
repoQ, numpq, err := queryRepo(pkgS)
|
||||
if err != nil {
|
||||
return
|
||||
pkgS = removeInvalidTargets(pkgS)
|
||||
var aurErr error
|
||||
var repoErr error
|
||||
var aq aurQuery
|
||||
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 {
|
||||
return fmt.Errorf("no packages match search")
|
||||
if lenpq == 0 && lenaq == 0 {
|
||||
return fmt.Errorf("No packages match search")
|
||||
}
|
||||
|
||||
if config.SortMode == BottomUp {
|
||||
aurQ.printSearch(numpq + 1)
|
||||
repoQ.printSearch()
|
||||
if mode == ModeAUR || mode == ModeAny {
|
||||
aq.printSearch(lenpq + 1)
|
||||
}
|
||||
if mode == ModeRepo || mode == ModeAny {
|
||||
pq.printSearch()
|
||||
}
|
||||
} else {
|
||||
repoQ.printSearch()
|
||||
aurQ.printSearch(numpq + 1)
|
||||
if mode == ModeRepo || mode == ModeAny {
|
||||
pq.printSearch()
|
||||
}
|
||||
if mode == ModeAUR || mode == ModeAny {
|
||||
aq.printSearch(lenpq + 1)
|
||||
}
|
||||
}
|
||||
|
||||
if aurErr != nil {
|
||||
|
@ -484,8 +504,8 @@ func numberMenu(pkgS []string, flags []string) (err error) {
|
|||
|
||||
isInclude := len(exclude) == 0 && len(otherExclude) == 0
|
||||
|
||||
for i, pkg := range repoQ {
|
||||
target := len(repoQ) - i
|
||||
for i, pkg := range pq {
|
||||
target := len(pq) - i
|
||||
if config.SortMode == TopDown {
|
||||
target = i + 1
|
||||
}
|
||||
|
@ -498,10 +518,10 @@ func numberMenu(pkgS []string, flags []string) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
for i, pkg := range aurQ {
|
||||
target := len(aurQ) - i + len(repoQ)
|
||||
for i, pkg := range aq {
|
||||
target := len(aq) - i + len(pq)
|
||||
if config.SortMode == TopDown {
|
||||
target = i + 1 + len(repoQ)
|
||||
target = i + 1 + len(pq)
|
||||
}
|
||||
|
||||
if isInclude && include.get(target) {
|
||||
|
|
34
query.go
34
query.go
|
@ -159,18 +159,36 @@ func narrowSearch(pkgS []string, sortS bool) (aurQuery, error) {
|
|||
|
||||
// SyncSearch presents a query to the local repos and to the AUR.
|
||||
func syncSearch(pkgS []string) (err error) {
|
||||
aq, aurErr := narrowSearch(pkgS, true)
|
||||
pq, _, err := queryRepo(pkgS)
|
||||
if err != nil {
|
||||
return err
|
||||
pkgS = removeInvalidTargets(pkgS)
|
||||
var aurErr error
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
if config.SortMode == BottomUp {
|
||||
aq.printSearch(1)
|
||||
pq.printSearch()
|
||||
if mode == ModeAUR || mode == ModeAny {
|
||||
aq.printSearch(1)
|
||||
}
|
||||
if mode == ModeRepo || mode == ModeAny {
|
||||
pq.printSearch()
|
||||
}
|
||||
} else {
|
||||
pq.printSearch()
|
||||
aq.printSearch(1)
|
||||
if mode == ModeRepo || mode == ModeAny {
|
||||
pq.printSearch()
|
||||
}
|
||||
if mode == ModeAUR || mode == ModeAny {
|
||||
aq.printSearch(1)
|
||||
}
|
||||
}
|
||||
|
||||
if aurErr != nil {
|
||||
|
|
Loading…
Reference in a new issue