Update handles messages.
(msg tea.Msg)
| 90 | |
| 91 | // Update handles messages. |
| 92 | func (f FirstTimeSetup) Update(msg tea.Msg) (tea.Model, tea.Cmd) { |
| 93 | switch msg := msg.(type) { |
| 94 | case tea.WindowSizeMsg: |
| 95 | f.width = msg.Width |
| 96 | f.height = msg.Height |
| 97 | return f, nil |
| 98 | |
| 99 | case ghCheckResultMsg: |
| 100 | return f.handleGHCheckResult(msg) |
| 101 | |
| 102 | case tea.KeyMsg: |
| 103 | switch f.step { |
| 104 | case StepGitignore: |
| 105 | return f.handleGitignoreKeys(msg) |
| 106 | case StepPRDName: |
| 107 | return f.handlePRDNameKeys(msg) |
| 108 | case StepPostCompletion: |
| 109 | return f.handlePostCompletionKeys(msg) |
| 110 | case StepGHError: |
| 111 | return f.handleGHErrorKeys(msg) |
| 112 | } |
| 113 | } |
| 114 | return f, nil |
| 115 | } |
| 116 | |
| 117 | func (f FirstTimeSetup) handleGitignoreKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 118 | switch msg.String() { |
nothing calls this directly
no test coverage detected