refactor for better maintainability and readabilty

This commit is contained in:
Robin Olsen
2026-02-17 11:11:54 +01:00
parent a38e32aa78
commit 279adb157e
7 changed files with 68 additions and 73 deletions

View File

@@ -34,6 +34,17 @@ func newIntroModel() introModel {
}
}
func (m introModel) Run() error {
model, err := tea.NewProgram(m, tea.WithAltScreen()).Run()
if err != nil {
return err
}
if m, ok := model.(introModel); ok && m.userQuit {
return ErrUserQuit
}
return nil
}
func (m introModel) Init() tea.Cmd {
return nil
}
@@ -68,17 +79,6 @@ func (m introModel) View() string {
return ""
}
func (m introModel) Run() error {
model, err := tea.NewProgram(m, tea.WithAltScreen()).Run()
if err != nil {
return err
}
if m, ok := model.(introModel); ok && m.userQuit {
return ErrUserQuit
}
return nil
}
func (m *introModel) SetSize(width, height int) {
m.width, m.height = width, height
}