From 191b5ebe47e08656176adcfea1fc8d58d5aebb9c Mon Sep 17 00:00:00 2001 From: morganamilo Date: Wed, 11 Apr 2018 00:45:58 +0100 Subject: [PATCH] Make colours more consistent and less ott Use yellow ==> for warning messages Keep white text no matter the colour of ==> Use cyan for pkgname printing like it already is in places --- config.go | 8 ++++---- conflicts.go | 10 +++++----- dependencies.go | 2 +- download.go | 6 +++--- install.go | 26 +++++++++++++------------- print.go | 12 ++++++------ query.go | 12 ++++++------ upgrade.go | 14 +++++++------- vcs.go | 4 ++-- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/config.go b/config.go index d113064d..86310b86 100644 --- a/config.go +++ b/config.go @@ -187,11 +187,11 @@ func editor() (string, []string) { fallthrough default: fmt.Println() - fmt.Println(bold(red(arrow)+" Warning:"), cyan("$EDITOR"), "is not set") - fmt.Println(bold(arrow) + " Please add " + cyan("$EDITOR") + " or " + cyan("$VISUAL") + " to your environment variables.") + fmt.Println(bold(red(arrow)), cyan("$EDITOR"), "is not set") + fmt.Println(bold(red(arrow)) + " Please add " + cyan("$EDITOR") + " or " + cyan("$VISUAL") + " to your environment variables.") for { - fmt.Print(green(bold(arrow)) + green(" Edit PKGBUILD with: ")) + fmt.Print(green(bold(arrow)) + " Edit PKGBUILD with: ") editorInput, err := getInput("") if err != nil { fmt.Println(err) @@ -225,7 +225,7 @@ func continueTask(s string, def string) (cont bool) { } var response string - fmt.Print(bold(green(arrow+" "+s+" ")), bold(postFix)) + fmt.Print(bold(green(arrow)+" "+s+" "), bold(postFix)) n, err := fmt.Scanln(&response) if err != nil || n == 0 { diff --git a/conflicts.go b/conflicts.go index 41ef7649..d26169aa 100644 --- a/conflicts.go +++ b/conflicts.go @@ -301,13 +301,13 @@ func checkForAllConflicts(dc *depCatagories) error { var wg sync.WaitGroup wg.Add(2) - fmt.Println(bold(cyan("::") + " Checking for conflicts...")) + fmt.Println(bold(cyan("::") + bold(" Checking for conflicts..."))) go func() { conflicts, err = checkForConflicts(dc) wg.Done() }() - fmt.Println(bold(cyan("::") + " Checking for inner conflicts...")) + fmt.Println(bold(cyan("::") + bold(" Checking for inner conflicts..."))) go func() { innerConflicts = checkForInnerConflicts(dc) wg.Done() @@ -325,7 +325,7 @@ func checkForAllConflicts(dc *depCatagories) error { for name, pkgs := range innerConflicts { str := "\t" + name + ":" for pkg := range pkgs { - str += " " + magenta(pkg) + str += " " + cyan(pkg) } fmt.Println(str) @@ -338,9 +338,9 @@ func checkForAllConflicts(dc *depCatagories) error { fmt.Println( red("\nPackage conflicts found:")) for name, pkgs := range conflicts { - str := "\tInstalling " + magenta(name) + " will remove:" + str := "\tInstalling " + cyan(name) + " will remove:" for pkg := range pkgs { - str += " " + magenta(pkg) + str += " " + cyan(pkg) } fmt.Println(str) diff --git a/dependencies.go b/dependencies.go index 3e35cf33..c74fd2e6 100644 --- a/dependencies.go +++ b/dependencies.go @@ -382,7 +382,7 @@ func getDepTree(pkgs []string) (*depTree, error) { } if len(dt.ToProcess) > 0 { - fmt.Println(bold(cyan("::") + " Querying AUR...")) + fmt.Println(bold(cyan("::") + bold(" Querying AUR..."))) } err = depTreeRecursive(dt, localDb, syncDb, false) diff --git a/download.go b/download.go index 72a71822..d4e6bacc 100644 --- a/download.go +++ b/download.go @@ -107,10 +107,10 @@ nextPkg: errD := downloadAndUnpack(url, path, true) if errD != nil { - fmt.Println(bold(magenta(pkg.Name())), bold(green(errD.Error()))) + fmt.Println(bold(red(arrow)) + " " + bold(cyan(pkg.Name())), bold(red(errD.Error()))) } - fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(magenta(pkg.Name())), bold(green("from ABS"))) + fmt.Println(bold(yellow(arrow)), "Downloaded", cyan(pkg.Name()), "from ABS") continue nextPkg } } @@ -130,7 +130,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(magenta(pkg.Name)), bold(green("from AUR"))) + fmt.Println(bold(yellow(arrow)), "Downloaded", cyan(pkg.Name), "from AUR") } return diff --git a/install.go b/install.go index 6814aee2..ddb00c45 100644 --- a/install.go +++ b/install.go @@ -129,7 +129,7 @@ func install(parser *arguments) error { } if hasAur && 0 == os.Geteuid() { - return fmt.Errorf(red(arrow + " Refusing to install AUR Packages as root, Aborting.")) + return fmt.Errorf(bold(red(arrow)) + " Refusing to install AUR Packages as root, Aborting.") } dc, err = getDepCatagories(requestTargets, dt) @@ -303,8 +303,8 @@ nextpkg: } if len(incompatible) > 0 { - fmt.Print( - bold(green(("\nThe following packages are not compatable with your architecture:")))) + fmt.Println() + fmt.Print(bold(yellow(arrow)) + " The following packages are not compatable with your architecture:") for pkg := range incompatible { fmt.Print(" " + cyan(pkg)) } @@ -347,7 +347,7 @@ func cleanEditNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed if askClean { fmt.Println(bold(green(arrow + " Packages to cleanBuild?"))) - fmt.Println(bold(green(arrow) + cyan(" [N]one ") + green("[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))) + fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")) fmt.Print(bold(green(arrow + " "))) cleanInput, err := getInput(config.AnswerClean) if err != nil { @@ -399,7 +399,7 @@ func cleanEditNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed } fmt.Println(bold(green(arrow + " PKGBUILDs to edit?"))) - fmt.Println(bold(green(arrow) + cyan(" [N]one ") + green("[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"))) + fmt.Println(bold(green(arrow) + cyan(" [N]one ") + "[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")) fmt.Print(bold(green(arrow + " "))) @@ -452,7 +452,7 @@ func cleanEditNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed func cleanBuilds(pkgs []*rpc.Pkg) { for i, pkg := range pkgs { dir := config.BuildDir + pkg.PackageBase - fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(pkgs), dir) + fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(pkgs), cyan(dir)) os.RemoveAll(dir) } } @@ -481,7 +481,7 @@ func parseSRCINFOFiles(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, bas dir := config.BuildDir + pkg.PackageBase + "/" str := bold(cyan("::") + " Parsing SRCINFO (%d/%d): %s\n") - fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases)) + fmt.Printf(str, k+1, len(pkgs), cyan(formatPkgbase(pkg, bases))) pkgbuild, err := gopkg.ParseSRCINFO(dir + ".SRCINFO") if err != nil { @@ -499,7 +499,7 @@ func tryParsesrcinfosFile(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, dir := config.BuildDir + pkg.PackageBase + "/" str := bold(cyan("::") + " Parsing SRCINFO (%d/%d): %s\n") - fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases)) + fmt.Printf(str, k+1, len(pkgs), cyan(formatPkgbase(pkg, bases))) pkgbuild, err := gopkg.ParseSRCINFO(dir + ".SRCINFO") if err != nil { @@ -549,7 +549,7 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*r if err == nil { if !version.Newer(pkgbuild.Version()) { str := bold(cyan("::") + " PKGBUILD up to date, Skipping (%d/%d): %s\n") - fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases)) + fmt.Printf(str, k+1, len(pkgs), cyan(formatPkgbase(pkg, bases))) continue } } @@ -558,7 +558,7 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*r str := bold(cyan("::") + " Downloading PKGBUILD (%d/%d): %s\n") - fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases)) + fmt.Printf(str, k+1, len(pkgs), cyan(formatPkgbase(pkg, bases))) err := downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false) if err != nil { @@ -580,7 +580,7 @@ func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, inco err = passToMakepkg(dir, args...) if err != nil { - return fmt.Errorf("Error downloading sources: %s", formatPkgbase(pkg, bases)) + return fmt.Errorf("Error downloading sources: %s", cyan(formatPkgbase(pkg, bases))) } } @@ -623,8 +623,8 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, } if built { - fmt.Println(bold(red(arrow+" Warning:")), - pkg.Name+"-"+pkg.Version+" Already made -- skipping build") + fmt.Println(bold(yellow(arrow)), + cyan(pkg.Name+"-"+pkg.Version) + bold(" Already made -- skipping build")) } else { args := []string{"-Ccf", "--noconfirm"} diff --git a/print.go b/print.go index 8f01f25d..06049092 100644 --- a/print.go +++ b/print.go @@ -131,7 +131,7 @@ func (u upSlice) Print(start int) { left, right := getVersionDiff(i.LocalVersion, i.RemoteVersion) fmt.Print(magenta(fmt.Sprintf("%3d ", len(u)+start-k-1))) - fmt.Print(bold(colourHash(i.Repository)), "/", cyan(i.Name)) + fmt.Print(bold(colourHash(i.Repository)), "/", bold(i.Name)) w := 70 - len(i.Repository) - len(i.Name) padding := fmt.Sprintf("%%%ds", w) @@ -216,7 +216,7 @@ func printDownloads(repoName string, length int, packages string) { repoInfo := bold(blue( "[" + repoName + ": " + strconv.Itoa(length) + "]")) - fmt.Println(repoInfo + magenta(packages)) + fmt.Println(repoInfo + cyan(packages)) } // PrintInfo prints package info like pacman -Si. @@ -277,10 +277,10 @@ func localStatistics() error { fmt.Printf(bold("Yay version v%s\n"), version) fmt.Println(bold(cyan("==========================================="))) - 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(green("Total installed packages: ")) + cyan(strconv.Itoa(info.Totaln))) + fmt.Println(bold(green("Total foreign installed packages: ")) + cyan(strconv.Itoa(len(remoteNames)))) + fmt.Println(bold(green("Explicitly installed packages: ")) + cyan(strconv.Itoa(info.Expln))) + fmt.Println(bold(green("Total Size occupied by packages: ")) + cyan(human(info.TotalSize))) fmt.Println(bold(cyan("==========================================="))) fmt.Println(bold(green("Ten biggest packages:"))) biggestPackages() diff --git a/query.go b/query.go index c2f0478f..2ac10f9a 100644 --- a/query.go +++ b/query.go @@ -503,25 +503,25 @@ func aurInfo(names []string) ([]*rpc.Pkg, error) { } if len(missing) > 0 { - fmt.Print(bold(red(arrow + " Missing AUR Packages:"))) + fmt.Print(bold(yellow("==> ")) + "Missing AUR Packages:") for _, name := range missing { - fmt.Print(" " + bold(magenta(name))) + fmt.Print(" " + cyan(name)) } fmt.Println() } if len(orphans) > 0 { - fmt.Print(bold(red(arrow + " Orphaned AUR Packages:"))) + fmt.Print(bold(yellow("==> ")) + "Orphaned AUR Packages:") for _, name := range orphans { - fmt.Print(" " + bold(magenta(name))) + fmt.Print(" " + cyan(name)) } fmt.Println() } if len(outOfDate) > 0 { - fmt.Print(bold(red(arrow + " Out Of Date AUR Packages:"))) + fmt.Print(bold(yellow("==> ")) + "Out Of Date AUR Packages:") for _, name := range outOfDate { - fmt.Print(" " + bold(magenta(name))) + fmt.Print(" " + cyan(name)) } fmt.Println() } diff --git a/upgrade.go b/upgrade.go index a4c0b70f..8b47bc9e 100644 --- a/upgrade.go +++ b/upgrade.go @@ -138,14 +138,14 @@ func upList() (aurUp upSlice, repoUp upSlice, err error) { var aurErr error var develErr error - fmt.Println(bold(cyan("::") + " Searching databases for updates...")) + fmt.Println(bold(cyan("::") + bold(" Searching databases for updates..."))) wg.Add(1) go func() { repoUp, repoErr = upRepo(local) wg.Done() }() - fmt.Println(bold(cyan("::") + " Searching AUR for updates...")) + fmt.Println(bold(cyan("::") + bold(" Searching AUR for updates..."))) wg.Add(1) go func() { aurUp, aurErr = upAUR(remote, remoteNames) @@ -153,7 +153,7 @@ func upList() (aurUp upSlice, repoUp upSlice, err error) { }() if config.Devel { - fmt.Println(bold(cyan("::") + " Checking development packages...")) + fmt.Println(bold(cyan("::") + bold(" Checking development packages..."))) wg.Add(1) go func() { develUp, develErr = upDevel(remote) @@ -229,7 +229,7 @@ func upDevel(remote []alpm.Package) (toUpgrade upSlice, err error) { for _, pkg := range toUpdate { if pkg.ShouldIgnore() { left, right := getVersionDiff(pkg.Version(), "latest-commit") - fmt.Print(magenta("Warning: ")) + fmt.Print(cyan("Warning: ")) fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { toUpgrade = append(toUpgrade, upgrade{pkg.Name(), "devel", pkg.Version(), "latest-commit"}) @@ -264,7 +264,7 @@ func upAUR(remote []alpm.Package, remoteNames []string) (upSlice, error) { (alpm.VerCmp(pkg.Version(), aurPkg.Version) < 0) { if pkg.ShouldIgnore() { left, right := getVersionDiff(pkg.Version(), aurPkg.Version) - fmt.Print(magenta("Warning: ")) + fmt.Print(cyan("Warning: ")) fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { toUpgrade = append(toUpgrade, upgrade{aurPkg.Name, "aur", pkg.Version(), aurPkg.Version}) @@ -290,7 +290,7 @@ func upRepo(local []alpm.Package) (upSlice, error) { if newPkg != nil { if pkg.ShouldIgnore() { left, right := getVersionDiff(pkg.Version(), newPkg.Version()) - fmt.Print(magenta("Warning: ")) + fmt.Print(cyan("Warning: ")) fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()}) @@ -311,7 +311,7 @@ func upgradePkgs(aurUp, repoUp upSlice) (stringSet, stringSet, error) { sort.Sort(repoUp) sort.Sort(aurUp) - fmt.Println(bold(blue("::")), len(aurUp)+len(repoUp), bold("Packages to upgrade.")) + fmt.Printf("%s"+bold(" %d ")+"%s\n", bold(cyan("::")), len(aurUp)+len(repoUp), bold("Packages to upgrade.")) repoUp.Print(len(aurUp) + 1) aurUp.Print(1) diff --git a/vcs.go b/vcs.go index 293ede12..a36b5cf1 100644 --- a/vcs.go +++ b/vcs.go @@ -57,7 +57,7 @@ func createDevelDB() error { } } - fmt.Println(bold(green(arrow + " GenDB finished. No packages were installed"))) + fmt.Println(bold(yellow(arrow) + bold(" GenDB finished. No packages were installed"))) return err } @@ -125,7 +125,7 @@ func updateVCSData(pkgName string, sources []string) { savedInfo[pkgName] = info - fmt.Println(bold(green(arrow+" Found git repo: ")) + cyan(url)) + fmt.Println(bold(yellow(arrow)) + " Found git repo: " + cyan(url)) saveVCSInfo() } }