aboutsummaryrefslogtreecommitdiffstats
path: root/termui/help_bar.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-04-12 11:11:01 +0200
committerMichael Muré <batolettre@gmail.com>2020-08-22 15:12:09 +0200
commit9ce84fc1a310e04ab63661f5fc3963a9de317981 (patch)
tree1a73a919d61ca742a3748140a0d040bfe10c5220 /termui/help_bar.go
parent88c28db99851e7f5cceed6544759d37ac87a34d4 (diff)
downloadgit-bug-9ce84fc1a310e04ab63661f5fc3963a9de317981.tar.gz
termui: make the help visually easier to parse
Diffstat (limited to 'termui/help_bar.go')
-rw-r--r--termui/help_bar.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/termui/help_bar.go b/termui/help_bar.go
new file mode 100644
index 00000000..eb6facb6
--- /dev/null
+++ b/termui/help_bar.go
@@ -0,0 +1,24 @@
+package termui
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/MichaelMure/git-bug/util/colors"
+)
+
+type helpBar []struct {
+ keys string
+ text string
+}
+
+func (hb helpBar) Render() string {
+ var builder strings.Builder
+ for i, entry := range hb {
+ if i != 0 {
+ builder.WriteByte(' ')
+ }
+ builder.WriteString(colors.BlueBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text)))
+ }
+ return builder.String()
+}