MCPcopy
hub / github.com/basecamp/once / Update

Method Update

internal/command/cli_progress.go:70–99  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

68}
69
70func (m *cliProgress) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
71 switch msg := msg.(type) {
72 case tea.WindowSizeMsg:
73 m.width = msg.Width
74 m.progress = m.progress.SetWidth(m.barWidth())
75 return m, nil
76
77 case cliProgressUpdateMsg:
78 switch msg.p.Stage {
79 case docker.DeployStageDownloading:
80 m.stage = "downloading"
81 m.progress = m.progress.SetPercent(msg.p.Percentage)
82 case docker.DeployStageStarting:
83 m.stage = "starting"
84 m.progress = m.progress.SetPercent(-1)
85 }
86 return m, m.waitForProgress()
87
88 case cliProgressDoneMsg:
89 m.err = msg.err
90 return m, tea.Quit
91
92 case ui.ProgressTickMsg:
93 var cmd tea.Cmd
94 m.progress, cmd = m.progress.Update(msg)
95 return m, cmd
96 }
97
98 return m, nil
99}
100
101func (m *cliProgress) View() tea.View {
102 prefix := m.label + " " + m.stage + ": "

Callers

nothing calls this directly

Calls 5

barWidthMethod · 0.95
waitForProgressMethod · 0.95
SetPercentMethod · 0.80
SetWidthMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected