talos-upgrade/pkg/upgrade/upgrade.go
2023-10-20 17:28:58 -04:00

32 lines
566 B
Go

package upgrade
import (
"fmt"
"log"
tea "github.com/charmbracelet/bubbletea"
)
type Upgrader struct {
core *CoreState
}
func (u *Upgrader) Init() tea.Cmd {
return nil
}
func (u *Upgrader) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
return u, tea.Quit
default:
log.Println(msg)
}
// assess state to determine which model to instantiate and call
return nil, nil
}
func (u *Upgrader) View() string {
return fmt.Sprintf("selected version %q, image: %q", u.core.SelectedVersion, u.core.SelectedImage)
}