mirror of
https://github.com/Jguer/yay
synced 2024-09-01 06:08:39 +00:00
commit
18e5b47e4a
51
cmd.go
51
cmd.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
alpm "github.com/jguer/go-alpm"
|
||||
|
@ -259,7 +260,7 @@ func handleSync() error {
|
|||
return syncClean(cmdArgs)
|
||||
}
|
||||
if cmdArgs.existsArg("l", "list") {
|
||||
return show(passToPacman(cmdArgs))
|
||||
return syncList(cmdArgs)
|
||||
}
|
||||
if cmdArgs.existsArg("g", "groups") {
|
||||
return show(passToPacman(cmdArgs))
|
||||
|
@ -385,3 +386,51 @@ func displayNumberMenu(pkgS []string) (err error) {
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
func syncList(parser *arguments) error {
|
||||
aur := false
|
||||
|
||||
for i := len(parser.targets) - 1; i >= 0; i-- {
|
||||
if parser.targets[i] == "aur" && (mode == modeAny || mode == modeAUR) {
|
||||
parser.targets = append(parser.targets[:i], parser.targets[i+1:]...)
|
||||
aur = true
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == modeAny || mode == modeAUR) && (len(parser.targets) == 0 || aur) {
|
||||
localDb, err := alpmHandle.LocalDb()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := http.Get(config.AURURL + "/packages.gz")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
scanner := bufio.NewScanner(resp.Body)
|
||||
|
||||
scanner.Scan()
|
||||
for scanner.Scan() {
|
||||
name := scanner.Text()
|
||||
if cmdArgs.existsArg("q", "quiet") {
|
||||
fmt.Println(name)
|
||||
} else {
|
||||
fmt.Printf("%s %s %s", magenta("aur"), bold(name), bold(green("unknown-version")))
|
||||
|
||||
if _, err := localDb.PkgByName(name); err == nil {
|
||||
fmt.Print(bold(blue(" [Installed]")))
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == modeAny || mode == modeRepo) && (len(parser.targets) != 0 || !aur) {
|
||||
return show(passToPacman(parser))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ If no operation is selected \-Y will be assumed.
|
|||
|
||||
.SH EXTENDED PACMAN OPERATIONS
|
||||
.TP
|
||||
.B \-S, \-Si, \-Ss, \-Su, \-Sc, \-Qu
|
||||
.B \-S, \-Si, \-Sl, \-Ss, \-Su, \-Sc, \-Qu
|
||||
These operations are extended to support both AUR and repo packages.
|
||||
|
||||
.TP
|
||||
|
|
8
go.mod
8
go.mod
|
@ -1,8 +1,8 @@
|
|||
module github.com/Jguer/yay/v9
|
||||
|
||||
require (
|
||||
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
|
||||
github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5
|
||||
github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5
|
||||
github.com/mikkeloscar/aur v0.0.0-20181111113612-b71516da3ae9
|
||||
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
|
||||
github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5
|
||||
github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5
|
||||
github.com/mikkeloscar/aur v0.0.0-20181111113612-b71516da3ae9
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue