(msg tea.KeyMsg)
| 333 | } |
| 334 | |
| 335 | func (f FirstTimeSetup) handleGHErrorKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 336 | switch msg.String() { |
| 337 | case "ctrl+c": |
| 338 | f.result.Cancelled = true |
| 339 | return f, tea.Quit |
| 340 | |
| 341 | case "esc": |
| 342 | // Go back to post-completion step |
| 343 | f.step = StepPostCompletion |
| 344 | return f, nil |
| 345 | |
| 346 | case "up", "k": |
| 347 | if f.ghErrorSelected > 0 { |
| 348 | f.ghErrorSelected-- |
| 349 | } |
| 350 | return f, nil |
| 351 | |
| 352 | case "down", "j": |
| 353 | if f.ghErrorSelected < 1 { |
| 354 | f.ghErrorSelected++ |
| 355 | } |
| 356 | return f, nil |
| 357 | |
| 358 | case "enter": |
| 359 | if f.ghErrorSelected == 0 { |
| 360 | // Continue without PR creation |
| 361 | f.result.CreatePROnComplete = false |
| 362 | return f, tea.Quit |
| 363 | } |
| 364 | // Try again |
| 365 | return f, func() tea.Msg { |
| 366 | installed, authenticated, err := git.CheckGHCLI() |
| 367 | return ghCheckResultMsg{installed: installed, authenticated: authenticated, err: err} |
| 368 | } |
| 369 | } |
| 370 | return f, nil |
| 371 | } |
| 372 | |
| 373 | // View renders the TUI. |
| 374 | func (f FirstTimeSetup) View() string { |
no test coverage detected