blob: 10d0b62af8a7359ce1da61c86e00d739a424d974 (
plain)
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 screens
import tea "github.com/charmbracelet/bubbletea"
type rootScreen struct{}
func _root() tea.Model {
return &rootScreen{}
}
func (r *rootScreen) Init() tea.Cmd {
return nil
}
func (r *rootScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
return r, tea.Quit
case "a":
return r, switchScreen(_aux())
}
}
return r, nil
}
func (r *rootScreen) View() string {
return "Welcome to Nectar!\nPress Ctrl+C to exit. Press 'a' to go to the auxiliary screen."
}
|