1
0
mirror of https://github.com/Jguer/yay synced 2024-07-05 18:01:50 +00:00

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
This commit is contained in:
morganamilo 2018-04-11 00:45:58 +01:00
parent 0aae012eb5
commit 191b5ebe47
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
9 changed files with 47 additions and 47 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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"}

View File

@ -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()

View File

@ -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()
}

View File

@ -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)

4
vcs.go
View File

@ -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()
}
}