From 27b20720849c9fe95c50eac8c9f8fd2eb92407d0 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Thu, 12 Mar 2026 17:03:41 +0100 Subject: [PATCH] make it so when users quit the intro questionare the survey closes --- cmd/pm/intro_questionnare.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/pm/intro_questionnare.go b/cmd/pm/intro_questionnare.go index b1f5de5..86fdf72 100644 --- a/cmd/pm/intro_questionnare.go +++ b/cmd/pm/intro_questionnare.go @@ -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 {