mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Merge pull request #136 from reesmichael1/prettify
Prettify repository download messages
This commit is contained in:
commit
fb8297881f
3 changed files with 35 additions and 34 deletions
|
@ -186,7 +186,7 @@ func continueTask(s string, def string) (cont bool) {
|
|||
}
|
||||
|
||||
var response string
|
||||
fmt.Print(boldGreenFg(arrow+" "+s), boldWhiteFg(postFix))
|
||||
fmt.Print(boldGreenFg(arrow+" "+s+" "), boldWhiteFg(postFix))
|
||||
|
||||
n, err := fmt.Scanln(&response)
|
||||
if err != nil || n == 0 {
|
||||
|
|
37
install.go
37
install.go
|
@ -4,9 +4,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
||||
alpm "github.com/jguer/go-alpm"
|
||||
rpc "github.com/mikkeloscar/aur"
|
||||
gopkg "github.com/mikkeloscar/gopkgbuild"
|
||||
)
|
||||
|
@ -70,37 +68,10 @@ func install(parser *arguments) error {
|
|||
}
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
|
||||
p1 := func(a []*alpm.Package) {
|
||||
for _, v := range a {
|
||||
fmt.Print(" ", v.Name())
|
||||
}
|
||||
}
|
||||
|
||||
p2 := func(a []*rpc.Pkg) {
|
||||
for _, v := range a {
|
||||
fmt.Print(" ", v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Print("Repo (" + strconv.Itoa(len(dc.Repo)) + "):")
|
||||
p1(dc.Repo)
|
||||
fmt.Println()
|
||||
|
||||
fmt.Print("Repo Make (" + strconv.Itoa(len(dc.RepoMake)) + "):")
|
||||
p1(dc.RepoMake)
|
||||
fmt.Println()
|
||||
|
||||
fmt.Print("Aur (" + strconv.Itoa(len(dc.Aur)) + "):")
|
||||
p2(dc.Aur)
|
||||
fmt.Println()
|
||||
|
||||
fmt.Print("Aur Make (" + strconv.Itoa(len(dc.AurMake)) + "):")
|
||||
p2(dc.AurMake)
|
||||
fmt.Println()
|
||||
|
||||
fmt.Println()
|
||||
printDownloadsFromRepo("Repo", dc.Repo)
|
||||
printDownloadsFromRepo("Repo Make", dc.RepoMake)
|
||||
printDownloadsFromAur("AUR", dc.Aur)
|
||||
printDownloadsFromAur("AUR Make", dc.AurMake)
|
||||
|
||||
askCleanBuilds(dc.AurMake)
|
||||
askCleanBuilds(dc.Aur)
|
||||
|
|
30
print.go
30
print.go
|
@ -94,6 +94,36 @@ func (s repoQuery) printSearch() {
|
|||
}
|
||||
}
|
||||
|
||||
// printDownloadsFromRepo prints repository packages to be downloaded
|
||||
func printDownloadsFromRepo(repoType string, repo []*alpm.Package) {
|
||||
var packages string
|
||||
for _, v := range repo {
|
||||
packages += v.Name() + " "
|
||||
}
|
||||
repoInfo := boldBlueFg(
|
||||
"[" + repoType + ", " + strconv.Itoa(len(repo)) + " packages] ")
|
||||
if len(repo) > 0 {
|
||||
printDownloads(repoInfo, packages)
|
||||
}
|
||||
}
|
||||
|
||||
// printDownloadsFromAur prints AUR packages to be downloaded
|
||||
func printDownloadsFromAur(repoType string, repo []*rpc.Pkg) {
|
||||
var packages string
|
||||
for _, v := range repo {
|
||||
packages += v.Name + " "
|
||||
}
|
||||
repoInfo := redFg(
|
||||
"[" + repoType + ", " + strconv.Itoa(len(repo)) + " packages] ")
|
||||
if len(repo) > 0 {
|
||||
printDownloads(repoInfo, packages)
|
||||
}
|
||||
}
|
||||
|
||||
func printDownloads(repoInfo, packages string) {
|
||||
fmt.Println(repoInfo + yellowFg(packages))
|
||||
}
|
||||
|
||||
func printDeps(repoDeps []string, aurDeps []string) {
|
||||
if len(repoDeps) != 0 {
|
||||
fmt.Print(boldGreenFg(arrow + " Repository dependencies: "))
|
||||
|
|
Loading…
Reference in a new issue