progress

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package progress reads what git writes to stderr with `--progress` while it works.

git rewrites one line with `\r` while a phase advances and ends it with `\n`, so the stream is cut at both. A line such as `Receiving objects: 45% (450/1000), 1.20 MiB` becomes a phase and a percentage; anything else is left to the error, if there is one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(text string) (phase string, percent int, ok bool)

Parse reads one line and says whether it was progress: a phase, a colon, and a percentage before anything else.

Types

type Report

type Report func(phase string, percent int)

Report is told each time a phase changes or its percentage moves.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer cuts git's stderr into lines, hands progress to a report and keeps the last lines of the rest, as many as room, for the error.

func NewWriter

func NewWriter(report Report) *Writer

NewWriter returns a writer that reports to report, which may be nil.

func (*Writer) Lines

func (writer *Writer) Lines() []string

Lines is what git said that was not progress, the last line included.

func (*Writer) Write

func (writer *Writer) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL