mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 11:09:17 -07:00
fix: avoid global state (#126)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
committed by
GitHub
parent
59e5d8e2c9
commit
60ddf33992
@@ -13,11 +13,6 @@ type model struct {
|
||||
selected map[int]struct{}
|
||||
}
|
||||
|
||||
var initialModel = model{
|
||||
choices: []string{"Carrots", "Celery", "Kohlrabi"},
|
||||
selected: make(map[int]struct{}),
|
||||
}
|
||||
|
||||
func (m model) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
@@ -72,6 +67,11 @@ func (m model) View() string {
|
||||
}
|
||||
|
||||
func main() {
|
||||
initialModel := model{
|
||||
choices: []string{"Carrots", "Celery", "Kohlrabi"},
|
||||
selected: make(map[int]struct{}),
|
||||
}
|
||||
|
||||
p := tea.NewProgram(initialModel)
|
||||
if err := p.Start(); err != nil {
|
||||
fmt.Printf("Alas, there's been an error: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user