forked from Mirrors/bubbletea
44 lines
655 B
Go
44 lines
655 B
Go
package main
|
|
|
|
// A simple example illustrating how to run a series of commands in order.
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type model struct{}
|
|
|
|
func (m model) Init() tea.Cmd {
|
|
return tea.Sequence(
|
|
tea.Batch(
|
|
tea.Println("A"),
|
|
tea.Println("B"),
|
|
tea.Println("C"),
|
|
),
|
|
tea.Println("Z"),
|
|
tea.Quit,
|
|
)
|
|
}
|
|
|
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
switch msg.(type) {
|
|
case tea.KeyMsg:
|
|
return m, tea.Quit
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (m model) View() string {
|
|
return ""
|
|
}
|
|
|
|
func main() {
|
|
if _, err := tea.NewProgram(model{}).Run(); err != nil {
|
|
fmt.Println("Uh oh:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|