Ports more text to new colour format.

This commit is contained in:
Jguer 2018-01-26 11:30:33 +00:00
parent 5286f3858c
commit f466fc74f5
No known key found for this signature in database
GPG key ID: 09754DBECF21746F
3 changed files with 26 additions and 8 deletions

9
cmd.go
View file

@ -561,9 +561,9 @@ func numberMenu(pkgS []string, flags []string) (err error) {
aurQ.printSearch(numpq + 1) aurQ.printSearch(numpq + 1)
} }
fmt.Printf("\x1b[32m%s %s\x1b[0m\nNumbers: ", fmt.Println(greenFg("Type the numbers or ranges (e.g. 1-10) you want to install. " +
"Type the numbers or ranges (e.g. 1-10) you want to install.", "Separate each one of them with a space."))
"Separate each one of them with a space.") fmt.Print("Numbers: ")
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
numberBuf, overflow, err := reader.ReadLine() numberBuf, overflow, err := reader.ReadLine()
if err != nil || overflow { if err != nil || overflow {
@ -673,7 +673,8 @@ func passToMakepkg(dir string, args ...string) (err error) {
if err == nil { if err == nil {
_ = saveVCSInfo() _ = saveVCSInfo()
if config.CleanAfter { if config.CleanAfter {
fmt.Println("\x1b[1;32m==> CleanAfter enabled. Deleting source folder.\x1b[0m") fmt.Println(boldGreenFg(arrow +
" CleanAfter enabled. Deleting source folder."))
os.RemoveAll(dir) os.RemoveAll(dir)
} }
} }

View file

@ -287,6 +287,14 @@ func redFg(in string) string {
return in return in
} }
func greenFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[0;32m" + in + "\x1b[0m"
}
return in
}
func yellowFg(in string) string { func yellowFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 { if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[0;33m" + in + "\x1b[0m" return "\x1b[0;33m" + in + "\x1b[0m"
@ -311,6 +319,14 @@ func boldYellowFg(in string) string {
return in return in
} }
func boldBlueFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[1;34m" + in + "\x1b[0m"
}
return in
}
func boldCyanFg(in string) string { func boldCyanFg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 { if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[1;36m" + in + "\x1b[0m" return "\x1b[1;36m" + in + "\x1b[0m"
@ -329,7 +345,7 @@ func boldWhiteFg(in string) string {
func redFgBlackBg(in string) string { func redFgBlackBg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 { if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[31;40m" + in + "\x1b[0m" return "\x1b[0;31;40m" + in + "\x1b[0m"
} }
return in return in
@ -337,7 +353,7 @@ func redFgBlackBg(in string) string {
func greenFgBlackBg(in string) string { func greenFgBlackBg(in string) string {
if alpmConf.Options&alpm.ConfColor > 0 { if alpmConf.Options&alpm.ConfColor > 0 {
return "\x1b[32;40m" + in + "\x1b[0m" return "\x1b[0;32;40m" + in + "\x1b[0m"
} }
return in return in

View file

@ -305,12 +305,13 @@ func upgradePkgs(flags []string) error {
var repoNums []int var repoNums []int
var aurNums []int var aurNums []int
sort.Sort(repoUp) sort.Sort(repoUp)
fmt.Printf("\x1b[1;34;1m:: \x1b[0m\x1b[1m%d Packages to upgrade.\x1b[0m\n", len(aurUp)+len(repoUp)) fmt.Println(boldBlueFg("::"), len(aurUp)+len(repoUp), boldWhiteFg("Packages to upgrade."))
repoUp.Print(len(aurUp) + 1) repoUp.Print(len(aurUp) + 1)
aurUp.Print(1) aurUp.Print(1)
if !config.NoConfirm { if !config.NoConfirm {
fmt.Print("\x1b[32mEnter packages you don't want to upgrade.\x1b[0m\nNumbers: ") fmt.Println(greenFg("Enter packages you don't want to upgrade."))
fmt.Print("Numbers: ")
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
numberBuf, overflow, err := reader.ReadLine() numberBuf, overflow, err := reader.ReadLine()