MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / Update

Method Update

tui/modify.go:306–386  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

304}
305
306func (m modifyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
307 switch msg := msg.(type) {
308 case modifyPricingMsg:
309 if msg.err == nil && msg.rates != nil {
310 m.pricing = &utils.PricingData{Rates: msg.rates}
311 }
312 m.pricingLoaded = true
313 return m, nil
314
315 case tea.KeyMsg:
316 switch msg.String() {
317 case "ctrl+c":
318 m.cancelled = true
319 m.quitting = true
320 return m, tea.Quit
321
322 case "q", "Q":
323 m.cancelled = true
324 m.quitting = true
325 return m, tea.Quit
326
327 case "esc":
328 if m.step == modifyStepCompute && !m.gpuCountPhase && m.needsGPUCountPhase() {
329 // Go back to GPU count selection phase
330 m.gpuCountPhase = true
331 m.cursor = 0
332 return m, nil
333 }
334 prev := m.prevVisibleStep(m.step)
335 if prev < 0 {
336 m.cancelled = true
337 m.quitting = true
338 return m, tea.Quit
339 }
340 m.step = prev
341 m.cursor = 0
342 m.gpuCountPhase = false
343 m.validationErr = nil
344 if m.step == modifyStepDiskSize {
345 m.diskInput.Focus()
346 m.diskInputTouched = false
347 } else {
348 m.diskInput.Blur()
349 }
350 return m, nil
351
352 case "up", "k":
353 if m.step != modifyStepDiskSize {
354 if m.cursor > 0 {
355 m.cursor--
356 }
357 }
358
359 case "down", "j":
360 if m.step != modifyStepDiskSize {
361 maxCursor := m.getMaxCursor()
362 if m.cursor < maxCursor {
363 m.cursor++

Callers

nothing calls this directly

Calls 4

needsGPUCountPhaseMethod · 0.95
prevVisibleStepMethod · 0.95
getMaxCursorMethod · 0.95
handleEnterMethod · 0.95

Tested by

no test coverage detected