(key string)
| 269 | } |
| 270 | |
| 271 | func (a App) handleInitAuthKey(key string) (tea.Model, tea.Cmd) { |
| 272 | switch a.authState { |
| 273 | case AuthStatePrompt: |
| 274 | switch key { |
| 275 | case "enter": |
| 276 | a.authState = AuthStateWaiting |
| 277 | return a, startAuthCmd(a.client) |
| 278 | case "esc", "ctrl+c", "q": |
| 279 | return a, tea.Quit |
| 280 | } |
| 281 | case AuthStateWaiting: |
| 282 | switch key { |
| 283 | case "esc", "ctrl+c": |
| 284 | return a, tea.Quit |
| 285 | case "r", "R": |
| 286 | a.authState = AuthStateWaiting |
| 287 | return a, startAuthCmd(a.client) |
| 288 | } |
| 289 | case AuthStateLoading: |
| 290 | if key == "esc" || key == "ctrl+c" { |
| 291 | return a, tea.Quit |
| 292 | } |
| 293 | case AuthStateError: |
| 294 | switch key { |
| 295 | case "enter": |
| 296 | a.authState = AuthStatePrompt |
| 297 | a.errorMsg = "" |
| 298 | case "esc", "ctrl+c": |
| 299 | return a, tea.Quit |
| 300 | } |
| 301 | } |
| 302 | return a, nil |
| 303 | } |
| 304 | |
| 305 | func (a App) handlePricingEvent(event views.PricingEvent) (tea.Model, tea.Cmd) { |
| 306 | switch event { |
no test coverage detected