mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
References #39, Sy
This commit is contained in:
parent
f80e3130ab
commit
6165007f2c
2 changed files with 45 additions and 0 deletions
39
install/i.go
Normal file
39
install/i.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
package install
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Install sends system commands to make and install a package from pkgName
|
||||
func Install(pkgName []string, flags []string) (err error) {
|
||||
q, err := rpc.Info(pkgName)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(q) != len(pkgName) {
|
||||
fmt.Printf("Some package from list\n%+v\ndoes not exist", pkgName)
|
||||
}
|
||||
|
||||
var finalrm []string
|
||||
for _, i := range q {
|
||||
mrm, err := PkgInstall(&i, flags)
|
||||
if err != nil {
|
||||
fmt.Println("Error installing", i.Name, ":", err)
|
||||
}
|
||||
finalrm = append(finalrm, mrm...)
|
||||
}
|
||||
|
||||
if len(finalrm) != 0 {
|
||||
err = RemoveMakeDeps(finalrm)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// PkgInstall handles install from Info Result.
|
||||
func PkgInstall(a []*rpc.Pkg, flags []string) (finalmdeps []string, err error) {
|
||||
for _, pkg := range a {
|
||||
if pkg.Maintainer == "" {
|
||||
fmt.Println("\x1b[1;31;40m==> Warning:\x1b[0;;40m This package is orphaned.\x1b[0m")
|
||||
}
|
||||
}
|
||||
}
|
6
yay.go
6
yay.go
|
@ -142,6 +142,12 @@ func main() {
|
|||
}
|
||||
case "-S":
|
||||
err = install(pkgs, options)
|
||||
case "-Sy":
|
||||
err = config.PassToPacman("-Sy", nil, nil)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
err = install(pkgs, options)
|
||||
case "-Syu", "-Suy", "-Su":
|
||||
if strings.Contains(op, "y") {
|
||||
err = config.PassToPacman("-Sy", nil, nil)
|
||||
|
|
Loading…
Reference in a new issue