diff --git a/cmd.go b/cmd.go index 85b46235..15e9dfac 100644 --- a/cmd.go +++ b/cmd.go @@ -579,7 +579,7 @@ func numberMenu(pkgS []string, flags []string) (err error) { aurQ.printSearch(numpq + 1) } - fmt.Println(bold(green(arrow) + green(" Packages to not upgrade (eg: 1 2 3, 1-3 or ^4)"))) + fmt.Println(bold(green(arrow + " Packages to install (eg: 1 2 3, 1-3 or ^4)"))) fmt.Print(bold(green(arrow + " "))) reader := bufio.NewReader(os.Stdin) numberBuf, overflow, err := reader.ReadLine() diff --git a/config.go b/config.go index 0c5244f1..b5101890 100644 --- a/config.go +++ b/config.go @@ -142,8 +142,8 @@ func editor() string { } fallthrough default: - fmt.Println(bold(red(blackBg("Warning:"))), - bold(yellow(blackBg("$EDITOR"))), white(blackBg("is not set"))) + fmt.Println(bold(red("Warning:")), + bold(magenta("$EDITOR")), "is not set") fmt.Println("Please add $EDITOR or to your environment variables.") editorLoop: @@ -179,7 +179,7 @@ func continueTask(s string, def string) (cont bool) { } var response string - fmt.Print(bold(green(arrow+" "+s+" ")), bold(white(postFix))) + fmt.Print(bold(green(arrow+" "+s+" ")), bold(postFix)) n, err := fmt.Scanln(&response) if err != nil || n == 0 { diff --git a/download.go b/download.go index 4cd54649..bccbdf85 100644 --- a/download.go +++ b/download.go @@ -101,10 +101,10 @@ nextPkg: errD := downloadAndUnpack(url, path, true) if errD != nil { - fmt.Println(bold(yellow(pkg.Name())), bold(green(errD.Error()))) + fmt.Println(bold(magenta(pkg.Name())), bold(green(errD.Error()))) } - fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(yellow(pkg.Name())), bold(green("from ABS"))) + fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(magenta(pkg.Name())), bold(green("from ABS"))) continue nextPkg } } @@ -124,7 +124,7 @@ func getPkgbuildsfromAUR(pkgs []string, dir string) (err error) { for _, pkg := range aq { downloadAndUnpack(baseURL+aq[0].URLPath, dir, false) - fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(yellow(pkg.Name)), bold(green("from AUR"))) + fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(magenta(pkg.Name)), bold(green("from AUR"))) } return diff --git a/install.go b/install.go index bc79a293..930e4cd3 100644 --- a/install.go +++ b/install.go @@ -56,8 +56,8 @@ func install(parser *arguments) error { //only error if direct targets or deps are missing for missingName := range dt.Missing { if !remoteNamesCache.get(missingName) { - return fmt.Errorf(bold(red(blackBg(arrow+" Error: "))) + - blackBg("Could not find all required package")) + return fmt.Errorf(bold(red(arrow+" Error: ")) + + "Could not find all required package") } } @@ -106,7 +106,7 @@ func install(parser *arguments) error { } //for _, pkg := range repoTargets { - //arguments.addTarget(pkg) + //arguments.addTarget(pkg) //} if len(dc.Aur) == 0 && len(arguments.targets) == 0 { @@ -125,7 +125,6 @@ func install(parser *arguments) error { return fmt.Errorf("Error installing repo packages.") } - depArguments := makeArguments() depArguments.addArg("D", "asdeps") @@ -301,9 +300,9 @@ func checkForConflicts(dc *depCatagories) error { fmt.Println( red("Package conflicts found:")) for name, pkgs := range toRemove { - str := "\tInstalling " + yellow(name) + " will remove" + str := "\tInstalling " + magenta(name) + " will remove" for pkg := range pkgs { - str += " " + yellow(pkg) + str += " " + magenta(pkg) } fmt.Println(str) @@ -447,8 +446,8 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, } if built { - fmt.Println(bold(red(blackBg(arrow+" Warning:"))), - blackBg(pkg.Name+"-"+pkg.Version+" Already made -- skipping build")) + fmt.Println(bold(red(arrow+" Warning:")), + pkg.Name+"-"+pkg.Version+" Already made -- skipping build") } else { err := passToMakepkg(dir, "-Ccf", "--noconfirm") if err != nil { diff --git a/print.go b/print.go index c1f4c4b9..eb5d5159 100644 --- a/print.go +++ b/print.go @@ -5,6 +5,7 @@ import ( "os" "strconv" "strings" + "time" alpm "github.com/jguer/go-alpm" rpc "github.com/mikkeloscar/aur" @@ -33,28 +34,30 @@ func (q aurQuery) printSearch(start int) { var toprint string if config.SearchMode == NumberMenu { if config.SortMode == BottomUp { - toprint += yellow(strconv.Itoa(len(q)+start-i-1) + " ") + toprint += magenta(strconv.Itoa(len(q)+start-i-1) + " ") } else { - toprint += yellow(strconv.Itoa(start+i) + " ") + toprint += magenta(strconv.Itoa(start+i) + " ") } } else if config.SearchMode == Minimal { fmt.Println(res.Name) continue } - toprint += bold(colourHash("aur")) + "/" + bold(yellow(res.Name)) + - " " + bold(cyan(res.Version)) + - " (" + strconv.Itoa(res.NumVotes) + ") " + + toprint += bold(colourHash("aur")) + "/" + bold(res.Name) + + " " + cyan(res.Version) + + bold(" (+"+strconv.Itoa(res.NumVotes)) + + " " + bold(strconv.FormatFloat(res.Popularity, 'f', 2, 64)+"%) ") if res.Maintainer == "" { - toprint += red(blackBg("(Orphaned)")) + " " + toprint += bold(red("(Orphaned)")) + " " } if res.OutOfDate != 0 { - toprint += red(blackBg("(Out-of-date)")) + " " + toprint += bold(red("(Out-of-date "+formatTime(res.OutOfDate)+")")) + " " } if _, err := localDb.PkgByName(res.Name); err == nil { - toprint += green(blackBg("Installed")) + toprint += bold(green("(Installed)")) } toprint += "\n " + res.Description fmt.Println(toprint) @@ -67,16 +70,19 @@ func (s repoQuery) printSearch() { var toprint string if config.SearchMode == NumberMenu { if config.SortMode == BottomUp { - toprint += yellow(strconv.Itoa(len(s)-i) + " ") + toprint += magenta(strconv.Itoa(len(s)-i) + " ") } else { - toprint += yellow(strconv.Itoa(i+1) + " ") + toprint += magenta(strconv.Itoa(i+1) + " ") } } else if config.SearchMode == Minimal { fmt.Println(res.Name()) continue } - toprint += colourHash(res.DB().Name()) + "/" + bold(yellow(res.Name())) + - " " + bold(cyan(res.Version())) + " " + + toprint += bold(colourHash(res.DB().Name())) + "/" + bold(res.Name()) + + " " + cyan(res.Version()) + + bold(" ("+human(res.Size())+ + " "+human(res.ISize())+") ") if len(res.Groups().Slice()) != 0 { toprint += fmt.Sprint(res.Groups().Slice(), " ") @@ -85,7 +91,7 @@ func (s repoQuery) printSearch() { localDb, err := alpmHandle.LocalDb() if err == nil { if _, err = localDb.PkgByName(res.Name()); err == nil { - toprint += green(blackBg("Installed")) + toprint += bold(green("(Installed)")) } } @@ -185,27 +191,27 @@ func printDownloads(repoName string, length int, packages string) { repoInfo := bold(blue( "[" + repoName + ": " + strconv.Itoa(length) + "]")) - fmt.Println(repoInfo + yellow(packages)) + fmt.Println(repoInfo + magenta(packages)) } // PrintInfo prints package info like pacman -Si. func PrintInfo(a *rpc.Pkg) { - fmt.Println(bold(white("Repository :")), "aur") - fmt.Println(bold(white("Name :")), a.Name) - fmt.Println(bold(white("Version :")), a.Version) - fmt.Println(bold(white("Description :")), a.Description) - fmt.Println(bold(white("URL :")), a.URL) - fmt.Println(bold(white("Licenses :")), strings.Join(a.License, " ")) - fmt.Println(bold(white("Depends On :")), strings.Join(a.Depends, " ")) - fmt.Println(bold(white("Make Deps :")), strings.Join(a.MakeDepends, " ")) - fmt.Println(bold(white("Check Deps :")), strings.Join(a.CheckDepends, " ")) - fmt.Println(bold(white("Optional Deps :")), strings.Join(a.OptDepends, " ")) - fmt.Println(bold(white("Conflicts With :")), strings.Join(a.Conflicts, " ")) - fmt.Println(bold(white("Maintainer :")), a.Maintainer) - fmt.Println(bold(white("Votes :")), a.NumVotes) - fmt.Println(bold(white("Popularity :")), a.Popularity) + fmt.Println(bold("Repository :"), "aur") + fmt.Println(bold("Name :"), a.Name) + fmt.Println(bold("Version :"), a.Version) + fmt.Println(bold("Description :"), a.Description) + fmt.Println(bold("URL :"), a.URL) + fmt.Println(bold("Licenses :"), strings.Join(a.License, " ")) + fmt.Println(bold("Depends On :"), strings.Join(a.Depends, " ")) + fmt.Println(bold("Make Deps :"), strings.Join(a.MakeDepends, " ")) + fmt.Println(bold("Check Deps :"), strings.Join(a.CheckDepends, " ")) + fmt.Println(bold("Optional Deps :"), strings.Join(a.OptDepends, " ")) + fmt.Println(bold("Conflicts With :"), strings.Join(a.Conflicts, " ")) + fmt.Println(bold("Maintainer :"), a.Maintainer) + fmt.Println(bold("Votes :"), a.NumVotes) + fmt.Println(bold("Popularity :"), a.Popularity) if a.OutOfDate != 0 { - fmt.Println(bold(white("Out-of-date :")), "Yes") + fmt.Println(bold("Out-of-date :"), "Yes", "["+formatTime(a.OutOfDate)+"]") } fmt.Println() @@ -226,7 +232,7 @@ func biggestPackages() { } for i := 0; i < 10; i++ { - fmt.Println(pkgS[i].Name() + ": " + yellow(human(pkgS[i].ISize()))) + fmt.Println(bold(pkgS[i].Name()) + ": " + cyan(human(pkgS[i].ISize()))) } // Could implement size here as well, but we just want the general idea } @@ -243,14 +249,14 @@ func localStatistics() error { return err } - fmt.Printf("\n Yay version r%s\n", version) + fmt.Printf(bold("Yay version v%s\n"), version) fmt.Println(bold(cyan("==========================================="))) - fmt.Println(bold(green("Total installed packages: ")) + yellow(strconv.Itoa(info.Totaln))) - fmt.Println(bold(green("Total foreign installed packages: ")) + yellow(strconv.Itoa(len(remoteNames)))) - fmt.Println(bold(green("Explicitly installed packages: ")) + yellow(strconv.Itoa(info.Expln))) - fmt.Println(bold(green("Total Size occupied by packages: ")) + yellow(human(info.TotalSize))) + fmt.Println(bold(green("Total installed packages: ")) + magenta(strconv.Itoa(info.Totaln))) + fmt.Println(bold(green("Total foreign installed packages: ")) + magenta(strconv.Itoa(len(remoteNames)))) + fmt.Println(bold(green("Explicitly installed packages: ")) + magenta(strconv.Itoa(info.Expln))) + fmt.Println(bold(green("Total Size occupied by packages: ")) + magenta(human(info.TotalSize))) fmt.Println(bold(cyan("==========================================="))) - fmt.Println(bold(green("Ten biggest packages"))) + fmt.Println(bold(green("Ten biggest packages:"))) biggestPackages() fmt.Println(bold(cyan("==========================================="))) @@ -299,6 +305,11 @@ func printUpdateList() error { return nil } +func formatTime(i int) string { + t := time.Unix(int64(i), 0) + return fmt.Sprintf("%d/%d/%d", t.Year(), int(t.Month()), t.Day()) +} + func red(in string) string { if alpmConf.Options&alpm.ConfColor > 0 { return "\x1b[31m" + in + "\x1b[0m" @@ -339,17 +350,9 @@ func cyan(in string) string { return in } -func white(in string) string { +func magenta(in string) string { if alpmConf.Options&alpm.ConfColor > 0 { - return "\x1b[37m" + in + "\x1b[0m" - } - - return in -} - -func blackBg(in string) string { - if alpmConf.Options&alpm.ConfColor > 0 { - return "\x1b[40m" + in + "\x1b[0m" + return "\x1b[35m" + in + "\x1b[0m" } return in diff --git a/query.go b/query.go index 26d20c3c..550b84b6 100644 --- a/query.go +++ b/query.go @@ -266,7 +266,7 @@ func hangingPackages() (hanging []string, err error) { requiredby := pkg.ComputeRequiredBy() if len(requiredby) == 0 { hanging = append(hanging, pkg.Name()) - fmt.Println(pkg.Name() + ": " + yellow(human(pkg.ISize()))) + fmt.Println(pkg.Name() + ": " + magenta(human(pkg.ISize()))) } return nil @@ -378,25 +378,25 @@ func aurInfo(names []string) ([]rpc.Pkg, error) { } if len(missing) > 0 { - fmt.Print(bold(red(blackBg(arrow + " Missing AUR Packages:")))) + fmt.Print(bold(red(arrow + " Missing AUR Packages:"))) for _, name := range missing { - fmt.Print(" " + bold(yellow(blackBg(name)))) + fmt.Print(" " + bold(magenta(name))) } fmt.Println() } if len(orphans) > 0 { - fmt.Print(bold(red(blackBg(arrow + " Orphaned AUR Packages:")))) + fmt.Print(bold(red(arrow + " Orphaned AUR Packages:"))) for _, name := range orphans { - fmt.Print(" " + bold(yellow(blackBg(name)))) + fmt.Print(" " + bold(magenta(name))) } fmt.Println() } if len(outOfDate) > 0 { - fmt.Print(bold(red(blackBg(arrow + " Out Of Date AUR Packages:")))) + fmt.Print(bold(red(arrow + " Out Of Date AUR Packages:"))) for _, name := range outOfDate { - fmt.Print(" " + bold(yellow(blackBg(name)))) + fmt.Print(" " + bold(magenta(name))) } fmt.Println() } diff --git a/upgrade.go b/upgrade.go index de44cf1b..9ef516d4 100644 --- a/upgrade.go +++ b/upgrade.go @@ -85,8 +85,8 @@ func (u upSlice) Print(start int) { for k, i := range u { left, right := getVersionDiff(i.LocalVersion, i.RemoteVersion) - fmt.Print(yellow(fmt.Sprintf("%2d ", len(u)+start-k-1))) - fmt.Print(bold(colourHash(i.Repository)), "/", bold(white(i.Name))) + fmt.Print(magenta(fmt.Sprintf("%2d ", len(u)+start-k-1))) + fmt.Print(bold(colourHash(i.Repository)), "/", cyan(i.Name)) w := 70 - len(i.Repository) - len(i.Name) + len(left) fmt.Printf(fmt.Sprintf("%%%ds", w), @@ -156,8 +156,8 @@ func upDevel(remote []alpm.Package, packageC chan upgrade, done chan bool) { } if found { if pkg.ShouldIgnore() { - fmt.Print(yellow("Warning: ")) - fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), pkg.Version(), "git") + fmt.Print(magenta("Warning: ")) + fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), pkg.Version(), "git") } else { packageC <- upgrade{e.Package, "devel", pkg.Version(), "commit-" + e.SHA[0:6]} } @@ -181,7 +181,7 @@ func upAUR(remote []alpm.Package, remoteNames []string, dt *depTree) (toUpgrade if config.Devel { routines++ go upDevel(remote, packageC, done) - fmt.Println(bold(cyan("::") + "Checking development packages...")) + fmt.Println(bold(cyan("::") + "Checking development packages...")) } routines++ @@ -196,8 +196,8 @@ func upAUR(remote []alpm.Package, remoteNames []string, dt *depTree) (toUpgrade (alpm.VerCmp(pkg.Version(), aurPkg.Version) < 0) { if pkg.ShouldIgnore() { left, right := getVersionDiff(pkg.Version(), aurPkg.Version) - fmt.Print(yellow("Warning: ")) - fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), left, right) + fmt.Print(magenta("Warning: ")) + fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { packageC <- upgrade{aurPkg.Name, "aur", pkg.Version(), aurPkg.Version} } @@ -245,7 +245,7 @@ func upRepo(local []alpm.Package) (upSlice, error) { newPkg := pkg.NewVersion(dbList) if newPkg != nil { if pkg.ShouldIgnore() { - fmt.Print(yellow("Warning: ")) + fmt.Print(magenta("Warning: ")) fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), pkg.Version(), newPkg.Version()) } else { slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()}) @@ -293,12 +293,12 @@ func upgradePkgs(dt *depTree) (stringSet, stringSet, error) { } sort.Sort(repoUp) - fmt.Println(bold(blue("::")), len(aurUp)+len(repoUp), bold(white("Packages to upgrade."))) + fmt.Println(bold(blue("::")), len(aurUp)+len(repoUp), bold("Packages to upgrade.")) repoUp.Print(len(aurUp) + 1) aurUp.Print(1) if !config.NoConfirm { - fmt.Println(bold(green(arrow)) + green(" Packages to not upgrade (eg: 1 2 3, 1-3 or ^4)")) + fmt.Println(bold(green(arrow + " Packages to not upgrade (eg: 1 2 3, 1-3 or ^4)"))) fmt.Print(bold(green(arrow + " "))) reader := bufio.NewReader(os.Stdin)