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