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

Method initStep

tui/create.go:339–369  ·  view source on GitHub ↗

initStep sets up step-specific state (cursor, focus, sub-phases) when arriving at a visible step.

()

Source from the content-addressed store, hash-verified

337
338// initStep sets up step-specific state (cursor, focus, sub-phases) when arriving at a visible step.
339func (m *createModel) initStep() {
340 m.cursor = 0
341 switch m.step {
342 case stepGPU:
343 gpus := m.getGPUOptions()
344 for i, gpu := range gpus {
345 if m.specs.IsGPUTypeAvailable(gpu) {
346 m.cursor = i
347 break
348 }
349 }
350 case stepCompute:
351 if m.specs.NeedsGPUCountPhase(m.config.GPUType) && m.config.NumGPUs == 0 {
352 m.gpuCountPhase = true
353 for i, count := range m.specs.GPUCounts(m.config.GPUType) {
354 if m.specs.IsSpecAvailable(m.config.GPUType, count) {
355 m.cursor = i
356 break
357 }
358 }
359 } else if !m.specs.NeedsGPUCountPhase(m.config.GPUType) {
360 m.config.NumGPUs = 1
361 m.setDefaultDiskSize()
362 m.gpuCountPhase = false
363 }
364 case stepDiskSize:
365 m.diskInput.SetValue(fmt.Sprintf("%d", m.config.DiskSizeGB))
366 m.diskInput.Focus()
367 m.diskInputTouched = false
368 }
369}
370
371// prevVisibleStep returns the previous non-skipped step. Returns -1 if none.
372func (m *createModel) prevVisibleStep(from createStep) createStep {

Callers 4

trySkipCurrentStepMethod · 0.95
trySkipTemplateMethod · 0.95
UpdateMethod · 0.95

Calls 6

getGPUOptionsMethod · 0.95
setDefaultDiskSizeMethod · 0.95
IsGPUTypeAvailableMethod · 0.80
NeedsGPUCountPhaseMethod · 0.80
GPUCountsMethod · 0.80
IsSpecAvailableMethod · 0.80

Tested by 1