| 307 | } |
| 308 | |
| 309 | func (f FirstTimeSetup) handleGHCheckResult(msg ghCheckResultMsg) (tea.Model, tea.Cmd) { |
| 310 | if msg.err != nil { |
| 311 | f.ghErrorMsg = fmt.Sprintf("Error checking gh CLI: %s", msg.err.Error()) |
| 312 | f.ghErrorSelected = 0 |
| 313 | f.step = StepGHError |
| 314 | return f, nil |
| 315 | } |
| 316 | |
| 317 | if !msg.installed { |
| 318 | f.ghErrorMsg = "GitHub CLI (gh) is not installed.\nInstall it from: https://cli.github.com" |
| 319 | f.ghErrorSelected = 0 |
| 320 | f.step = StepGHError |
| 321 | return f, nil |
| 322 | } |
| 323 | |
| 324 | if !msg.authenticated { |
| 325 | f.ghErrorMsg = "GitHub CLI (gh) is not authenticated.\nRun: gh auth login" |
| 326 | f.ghErrorSelected = 0 |
| 327 | f.step = StepGHError |
| 328 | return f, nil |
| 329 | } |
| 330 | |
| 331 | // gh is installed and authenticated - done |
| 332 | return f, tea.Quit |
| 333 | } |
| 334 | |
| 335 | func (f FirstTimeSetup) handleGHErrorKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
| 336 | switch msg.String() { |