MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / handleKey

Method handleKey

internal/tui/app.go:238–269  ·  view source on GitHub ↗
(msg tea.KeyMsg)

Source from the content-addressed store, hash-verified

236}
237
238func (a App) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
239 key := msg.String()
240
241 if a.viewMode == ViewModeInitAuth {
242 return a.handleInitAuthKey(key)
243 }
244
245 // F3: refresh metadata from any view
246 if key == "f3" {
247 if a.authState != AuthStateLoading {
248 a.authState = AuthStateLoading
249 a.loadingFrame = 0
250 a.metadataRefreshMsg = "Refreshing metadata..."
251 a.refreshMsgFrames = 60
252 return a, downloadMetadataCmd(a.client)
253 }
254 return a, nil
255 }
256
257 switch a.viewMode {
258 case ViewModePricing:
259 event := a.pricingView.HandleKey(key)
260 return a.handlePricingEvent(event)
261 case ViewModeHistory:
262 event, idx := a.historyView.HandleKey(key)
263 return a.handleHistoryEvent(event, idx)
264 case ViewModeSettings:
265 event := a.settingsView.HandleKey(key)
266 return a.handleSettingsEvent(event)
267 }
268 return a, nil
269}
270
271func (a App) handleInitAuthKey(key string) (tea.Model, tea.Cmd) {
272 switch a.authState {

Callers 1

UpdateMethod · 0.95

Calls 7

handleInitAuthKeyMethod · 0.95
handlePricingEventMethod · 0.95
handleHistoryEventMethod · 0.95
handleSettingsEventMethod · 0.95
downloadMetadataCmdFunction · 0.85
StringMethod · 0.80
HandleKeyMethod · 0.45

Tested by

no test coverage detected