mirror of
https://github.com/Jguer/yay
synced 2024-10-05 23:59:13 +00:00
Reimplement getpkgbuild
Futre todos: Add option to fetch deps Add option to set download path
This commit is contained in:
parent
68a9771327
commit
3084f91ba7
16
cmd.go
16
cmd.go
|
@ -241,6 +241,8 @@ func handleCmd(parser *argParser) (changedConfig bool, err error) {
|
|||
passToPacman(parser)
|
||||
case "U", "upgrade":
|
||||
passToPacman(parser)
|
||||
case "G", "getpkgbuild":
|
||||
err = handleGetpkgbuild(parser)
|
||||
case "Y", "--yay":
|
||||
err = handleYay(parser)
|
||||
default:
|
||||
|
@ -349,6 +351,20 @@ func handleYay(parser *argParser) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func handleGetpkgbuild(parser *argParser) (err error) {
|
||||
for pkg := range parser.targets {
|
||||
err = getPkgbuild(pkg)
|
||||
if err != nil {
|
||||
//we print the error instead of returning it
|
||||
//seems as we can handle multiple errors without stoping
|
||||
//theres no easy way arround this right now
|
||||
fmt.Println(pkg + ":", err)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func handleYogurt(parser *argParser) (err error) {
|
||||
// TODO
|
||||
// _, options, targets := parser.formatArgs()
|
||||
|
|
10
parser.go
10
parser.go
|
@ -7,19 +7,21 @@ import (
|
|||
"io"
|
||||
)
|
||||
|
||||
type set map[string]struct{}
|
||||
|
||||
type argParser struct {
|
||||
op string
|
||||
options map[string]string
|
||||
doubles map[string]struct{} //tracks args passed twice such as -yy and -dd
|
||||
targets map[string]struct{}
|
||||
doubles set //tracks args passed twice such as -yy and -dd
|
||||
targets set
|
||||
}
|
||||
|
||||
func makeArgParser() *argParser {
|
||||
return &argParser {
|
||||
"",
|
||||
make(map[string]string),
|
||||
make(map[string]struct{}),
|
||||
make(map[string]struct{}),
|
||||
make(set),
|
||||
make(set),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue