1package termui
2
3import (
4 "fmt"
5 "strings"
6
7 text "github.com/MichaelMure/go-term-text"
8
9 "github.com/MichaelMure/git-bug/util/colors"
10)
11
12type helpBar []struct {
13 keys string
14 text string
15}
16
17func (hb helpBar) Render(maxX int) string {
18 var builder strings.Builder
19 for _, entry := range hb {
20 builder.WriteString(colors.BlueBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text)))
21 builder.WriteByte(' ')
22 }
23
24 l := text.Len(builder.String())
25 if l < maxX {
26 builder.WriteString(colors.BlueBg(strings.Repeat(" ", maxX-l)))
27 }
28
29 return builder.String()
30}