Finishes porting text to new colour format.

This commit is contained in:
Jguer 2018-01-26 15:04:10 +00:00
parent f466fc74f5
commit ecc337c29f
No known key found for this signature in database
GPG key ID: 09754DBECF21746F
4 changed files with 20 additions and 12 deletions

View file

@ -146,10 +146,12 @@ func editor() string {
}
fallthrough
default:
fmt.Printf("\x1b[1;31;40mWarning: \x1B[1;33;40m$EDITOR\x1b[0;37;40m is not set.\x1b[0m\nPlease add $EDITOR or to your environment variables.\n")
fmt.Println(boldRedFgBlackBg("Warning:"),
boldYellowFgBlackBg("$EDITOR"), whiteFgBlackBg("is not set"))
fmt.Println("Please add $EDITOR or to your environment variables.")
editorLoop:
fmt.Printf("\x1b[32m%s\x1b[0m ", "Edit PKGBUILD with:")
fmt.Print(greenFg("Edit PKGBUILD with:"))
var editorInput string
_, err := fmt.Scanln(&editorInput)
if err != nil {
@ -181,7 +183,7 @@ func continueTask(s string, def string) (cont bool) {
}
var response string
fmt.Printf("\x1b[1;32m==> %s\x1b[1;37m %s\x1b[0m", s, postFix)
fmt.Println(boldGreenFg(arrow+" "+s), boldWhiteFg(postFix))
n, err := fmt.Scanln(&response)
if err != nil || n == 0 {

View file

@ -97,7 +97,7 @@ func getPkgbuildfromABS(pkgN string, path string) (err error) {
} else {
return fmt.Errorf("Not in standard repositories")
}
fmt.Printf("\x1b[1;32m==>\x1b[1;33m %s \x1b[1;32mfound in ABS.\x1b[0m\n", pkgN)
fmt.Println(boldGreenFg(arrow), boldYellowFg(pkgN), boldGreenFg("found in ABS."))
errD := downloadAndUnpack(url, path, true)
return errD
}
@ -116,7 +116,7 @@ func getPkgbuildfromAUR(pkgN string, dir string) (err error) {
return fmt.Errorf("no results")
}
fmt.Printf("\x1b[1;32m==>\x1b[1;33m %s \x1b[1;32mfound in AUR.\x1b[0m\n", pkgN)
fmt.Println(boldGreenFg(arrow), boldYellowFg(pkgN), boldGreenFg("found in AUR."))
downloadAndUnpack(baseURL+aq[0].URLPath, dir, false)
return
}

View file

@ -10,7 +10,6 @@ import (
rpc "github.com/mikkeloscar/aur"
)
const warning = "\x1b[33mWarning:\x1b[0m "
const arrow = "==>"
// Human returns results in Human readable format.
@ -303,6 +302,13 @@ func yellowFg(in string) string {
return in
}
func boldFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[1m" + in + "\x1b[0m"
}
return in
}
func boldGreenFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[1;32m" + in + "\x1b[0m"

View file

@ -102,14 +102,14 @@ func upList() (aurUp upSlice, repoUp upSlice, err error) {
aurC := make(chan upSlice)
errC := make(chan error)
fmt.Println("\x1b[1;36;1m::\x1b[0m\x1b[1m Searching databases for updates...\x1b[0m")
fmt.Println(boldCyanFg("::"), boldFg("Searching databases for updates..."))
go func() {
repoUpList, err := upRepo(local)
errC <- err
repoC <- repoUpList
}()
fmt.Println("\x1b[1;36;1m::\x1b[0m\x1b[1m Searching AUR for updates...\x1b[0m")
fmt.Println(boldCyanFg("::"), boldFg("Searching AUR for updates..."))
go func() {
aurUpList, err := upAUR(remote, remoteNames)
errC <- err
@ -153,7 +153,7 @@ func upDevel(remote []alpm.Package, packageC chan upgrade, done chan bool) {
}
if found {
if pkg.ShouldIgnore() {
fmt.Print(warning)
fmt.Print(yellowFg("Warning: "))
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), pkg.Version(), "git")
} else {
packageC <- upgrade{e.Package, "devel", e.SHA[0:6], "git"}
@ -179,7 +179,7 @@ func upAUR(remote []alpm.Package, remoteNames []string) (toUpgrade upSlice, err
if config.Devel {
routines++
go upDevel(remote, packageC, done)
fmt.Println("\x1b[1;36;1m::\x1b[0m\x1b[1m Checking development packages...\x1b[0m")
fmt.Println(boldCyanFg("::"), boldFg("Checking development packages..."))
}
for i := len(remote); i != 0; i = j {
@ -211,7 +211,7 @@ func upAUR(remote []alpm.Package, remoteNames []string) (toUpgrade upSlice, err
if (config.TimeUpdate && (int64(qtemp[x].LastModified) > local[i].BuildDate().Unix())) ||
(alpm.VerCmp(local[i].Version(), qtemp[x].Version) < 0) {
if local[i].ShouldIgnore() {
fmt.Print(warning)
fmt.Print(yellowFg("Warning: "))
fmt.Printf("%s ignoring package upgrade (%s => %s)\n", local[i].Name(), local[i].Version(), qtemp[x].Version)
} else {
packageC <- upgrade{qtemp[x].Name, "aur", local[i].Version(), qtemp[x].Version}
@ -259,7 +259,7 @@ func upRepo(local []alpm.Package) (upSlice, error) {
newPkg := pkg.NewVersion(dbList)
if newPkg != nil {
if pkg.ShouldIgnore() {
fmt.Print(warning)
fmt.Print(yellowFg("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()})