forked from sturdy-dev/marblezero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.go
40 lines (33 loc) · 824 Bytes
/
help.go
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
31
32
33
34
35
36
37
38
39
40
package main
import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
type helpModel struct{}
func NewHelpModel() tea.Model {
return &helpModel{}
}
func (m *helpModel) Init() tea.Cmd {
return nil
}
func (m *helpModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "q", "esc", "enter":
return m, goToHomeCmd
}
}
return m, nil
}
func (m *helpModel) View() string {
var commands []string = []string{
listHeader("Commands"),
"a: show achivements",
"r: rename your pet",
"q / esc / enter / cmd+c: quit",
"",
lipgloss.NewStyle().Foreground(subtle).Render("(press enter to go back)"),
}
return deviceRightStyle.Copy().PaddingLeft(1).Render(lipgloss.JoinVertical(lipgloss.Left, commands...))
}