make it so when users quit the intro questionare the survey closes

This commit is contained in:
Robin Olsen
2026-03-12 17:03:41 +01:00
parent b90c30cf5d
commit 27b2072084

View File

@@ -16,11 +16,19 @@ func (iq *IntroQuestionnaire) Run() (map[string]any, error) {
model := task.NewQuestionnaireModel(iq.Questions(), iq.Keys())
app := tea.NewProgram(model, tea.WithAltScreen())
if _, err := app.Run(); err != nil {
m, err := app.Run()
if err != nil {
return nil, err
}
return model.GetAnswers(), nil
if q, ok := m.(*task.QuestionnaireModel); ok {
if q.GetUserQuit() {
return nil, task.ErrUserQuit
}
return q.GetAnswers(), nil
}
return nil, nil
}
func (iq *IntroQuestionnaire) Questions() task.Questions {