From 9fa8c9265e740e5762c0c07afbfffe5b7c025669 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sun, 21 May 2017 15:49:29 +0200 Subject: [PATCH] Improve query list formatting --- pacman/pacman.go | 6 +++--- query.go | 6 +++--- yay.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pacman/pacman.go b/pacman/pacman.go index da32b714..ec801989 100644 --- a/pacman/pacman.go +++ b/pacman/pacman.go @@ -71,9 +71,9 @@ func (s Query) PrintSearch() { var toprint string if config.YayConf.SearchMode == config.NumberMenu { if config.YayConf.SortMode == config.BottomUp { - toprint += fmt.Sprintf("%d ", len(s)-i-1) + toprint += fmt.Sprintf("\x1b[33m%d\x1b[0m ", len(s)-i-1) } else { - toprint += fmt.Sprintf("%d ", i) + toprint += fmt.Sprintf("\x1b[33m%d\x1b[0m ", i) } } else if config.YayConf.SearchMode == config.Minimal { fmt.Println(res.Name()) @@ -93,7 +93,7 @@ func (s Query) PrintSearch() { } } - toprint += "\n" + res.Description() + toprint += "\n " + res.Description() fmt.Println(toprint) } } diff --git a/query.go b/query.go index 1afa3441..3a8e528a 100644 --- a/query.go +++ b/query.go @@ -17,9 +17,9 @@ func printAURSearch(q aur.Query, start int) { var toprint string if config.YayConf.SearchMode == config.NumberMenu { if config.YayConf.SortMode == config.BottomUp { - toprint += fmt.Sprintf("%d ", len(q)+start-i-1) + toprint += fmt.Sprintf("\x1b[33m%d\x1b[0m ", len(q)+start-i-1) } else { - toprint += fmt.Sprintf("%d ", start+i) + toprint += fmt.Sprintf("\x1b[33m%d\x1b[0m ", start+i) } } else if config.YayConf.SearchMode == config.Minimal { fmt.Println(res.Name) @@ -37,7 +37,7 @@ func printAURSearch(q aur.Query, start int) { if _, err := localDb.PkgByName(res.Name); err == nil { toprint += fmt.Sprintf("\x1b[32;40mInstalled\x1b[0m") } - toprint += "\n" + res.Description + toprint += "\n " + res.Description fmt.Println(toprint) } diff --git a/yay.go b/yay.go index f05a981b..568421cb 100644 --- a/yay.go +++ b/yay.go @@ -184,7 +184,7 @@ func numberMenu(pkgS []string, flags []string) (err error) { printAURSearch(aq, numpq) } - fmt.Printf("\x1b[32m%s\x1b[0m\nNumbers:", "Type numbers to install. Separate each number with a space.") + fmt.Printf("\x1b[32m%s\x1b[0m\nNumbers: ", "Type numbers to install. Separate each number with a space.") reader := bufio.NewReader(os.Stdin) numberBuf, overflow, err := reader.ReadLine() if err != nil || overflow {