Write intercepts the content and updates the percentage
(raw []byte)
| 59 | |
| 60 | // Write intercepts the content and updates the percentage |
| 61 | func (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 | |
| 77 | func finalPause() tea.Cmd { |
| 78 | return tea.Tick(time.Millisecond*750, func(_ time.Time) tea.Msg { |
no test coverage detected