MCPcopy
hub / github.com/MadAppGang/dingo / PrintSummary

Method PrintSummary

pkg/ui/styles.go:227–287  ·  view source on GitHub ↗

PrintSummary prints the final build summary with mascot

(success bool, errorMsg string)

Source from the content-addressed store, hash-verified

225
226// PrintSummary prints the final build summary with mascot
227func (b *BuildOutput) PrintSummary(success bool, errorMsg string) {
228 elapsed := time.Since(b.startTime)
229
230 fmt.Println() // Extra line before summary
231
232 // Get mascot for success or failure
233 var m *mascot.Mascot
234 if success {
235 m = mascot.New(mascot.WithInitialState(mascot.StateSuccess))
236 } else {
237 m = mascot.New(mascot.WithInitialState(mascot.StateFailed))
238 }
239 frame := m.Render()
240
241 // Apply color based on status
242 var mascotColor lipgloss.Style
243 if success {
244 mascotColor = lipgloss.NewStyle().Foreground(colorSuccess)
245 } else {
246 mascotColor = lipgloss.NewStyle().Foreground(colorError)
247 }
248
249 // Build summary lines
250 var summaryLines []string
251 if success {
252 duration := formatDuration(elapsed)
253 summaryLines = []string{
254 "",
255 " " + styleSuccess.Render("Build Successful!"),
256 " " + styleStepTime.Render("Completed in "+duration),
257 }
258 } else {
259 summaryLines = []string{
260 "",
261 " " + styleError.Render("Build Failed"),
262 }
263 if errorMsg != "" {
264 summaryLines = append(summaryLines, " "+styleError.Render("Error: ")+errorMsg)
265 }
266 }
267
268 // Print mascot with summary on the right
269 maxLines := len(frame)
270 if len(summaryLines) > maxLines {
271 maxLines = len(summaryLines)
272 }
273
274 for i := 0; i < maxLines; i++ {
275 mascotLine := ""
276 if i < len(frame) {
277 mascotLine = mascotColor.Render(frame[i])
278 }
279
280 summaryLine := ""
281 if i < len(summaryLines) {
282 summaryLine = summaryLines[i]
283 }
284

Callers

nothing calls this directly

Calls 5

RenderMethod · 0.95
NewFunction · 0.92
WithInitialStateFunction · 0.92
PrintfMethod · 0.80
formatDurationFunction · 0.70

Tested by

no test coverage detected