handleSettingsGHCheck handles the GH CLI check result from settings.
(msg settingsGHCheckResultMsg)
| 1513 | |
| 1514 | // handleSettingsGHCheck handles the GH CLI check result from settings. |
| 1515 | func (a App) handleSettingsGHCheck(msg settingsGHCheckResultMsg) (tea.Model, tea.Cmd) { |
| 1516 | if a.viewMode != ViewSettings { |
| 1517 | return a, nil |
| 1518 | } |
| 1519 | |
| 1520 | if msg.err != nil || !msg.installed || !msg.authenticated { |
| 1521 | // Validation failed - revert toggle and show error |
| 1522 | a.settingsOverlay.RevertToggle() |
| 1523 | errMsg := "GitHub CLI (gh) is not installed" |
| 1524 | if msg.installed && !msg.authenticated { |
| 1525 | errMsg = "GitHub CLI (gh) is not authenticated. Run: gh auth login" |
| 1526 | } |
| 1527 | if msg.err != nil { |
| 1528 | errMsg = msg.err.Error() |
| 1529 | } |
| 1530 | a.settingsOverlay.SetGHError(errMsg) |
| 1531 | return a, nil |
| 1532 | } |
| 1533 | |
| 1534 | // Validation passed - save the config |
| 1535 | a.settingsOverlay.ApplyToConfig(a.config) |
| 1536 | _ = config.Save(a.baseDir, a.config) |
| 1537 | return a, nil |
| 1538 | } |
| 1539 | |
| 1540 | // handleCompletionKeys handles keyboard input for the completion screen. |
| 1541 | func (a App) handleCompletionKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { |
no test coverage detected