MCPcopy Create free account
hub / github.com/LunaSource/Luna / Update

Method Update

ui/models.go:126–167  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

124 }
125
126 case availableFilesMsg:
127 if msg.err != nil {
128 m.err = msg.err
129 m.state = stateError
130 return m, nil
131 }
132 if len(msg.files) == 0 {
133 m.state = stateComplete
134 return m, tea.Quit
135 }
136 m.available = msg.files
137 m.selected = make(map[string]bool)
138 m.cursor = 0
139 m.state = stateSelecting
140 return m, nil
141
142 case stagedMsg:
143 if msg.err != nil {
144 m.err = msg.err
145 m.state = stateError
146 return m, nil
147 }
148 m.state = stateProcessing
149 return m, processNextFile(m)
150
151 case fileProcessedMsg:
152 if msg.err != nil {
153 m.commitResults[msg.filename] = "Error: " + msg.err.Error()
154 } else {
155 m.commitResults[msg.filename] = msg.result
156 }
157
158 m.commitMsgs[msg.filename] = m.commitMsgs[msg.filename]
159
160 m.state = stateReview
161 return m, nil
162 }
163
164 var cmd tea.Cmd
165 m.spinner, cmd = m.spinner.Update(msg)
166 return m, cmd
167}
168
169func processNextFile(m CommitUI) tea.Cmd {
170 if m.currentFile >= len(m.files) {

Callers

nothing calls this directly

Calls 2

handleReviewInputFunction · 0.85
processNextFileFunction · 0.85

Tested by

no test coverage detected