MCPcopy Create free account
hub / github.com/catppuccin/cli / Write

Method Write

internal/ui/progress.go:61–75  ·  view source on GitHub ↗

Write intercepts the content and updates the percentage

(raw []byte)

Source from the content-addressed store, hash-verified

59
60// Write intercepts the content and updates the percentage
61func (g GitProgress) Write(raw []byte) (n int, err error) {
62 data := string(raw)
63 matches := re.FindStringSubmatch(data)
64 if len(matches) > 1 {
65 deltaMatch := reEnd.FindStringSubmatch(data) // Please delete this. This does not work at all. :sadge:
66 if !strings.Contains(deltaMatch[1], "Resolving deltas") {
67 percentage, _ := strconv.Atoi(matches[1])
68 g.Progress = percentage
69 p.Send(progressMsg(percentage / 100)) // Send the progressMsg out
70 } else {
71 p.Send(finishMsg(deltaMatch[1])) // This should, in theory, send out finishMsg, but it does not.
72 }
73 }
74 return len(raw), err
75}
76
77func finalPause() tea.Cmd {
78 return tea.Tick(time.Millisecond*750, func(_ time.Time) tea.Msg {

Callers 1

MakeLocationFunction · 0.80

Calls 2

progressMsgTypeAlias · 0.85
finishMsgTypeAlias · 0.85

Tested by

no test coverage detected