explaingit

schollz/progressbar

4,671GoAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A small Go library that adds a thread-safe progress bar or spinner to command-line programs, working on Windows, macOS, and Linux with no special dependencies.

Mindmap

mindmap
  root((progressbar))
    What it does
      Terminal progress bar
      Spinner for unknown size
      Stream attachment
      In-place rendering
    Tech Stack
      Go library
      Thread-safe
      Cross-platform
    Use Cases
      File downloads
      CLI tools
      Batch processing
    Audience
      Go developers
      CLI builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a progress bar to a Go CLI tool that processes files one by one.

USE CASE 2

Show real-time download progress when fetching files in a Go program.

USE CASE 3

Display a spinner when running a task of unknown total length in the terminal.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial projects, as long as you keep the MIT copyright notice.

In plain English

This is a small Go library that adds a progress bar to command-line programs. It was written because the author needed one for another project called croc and found that existing options had compatibility problems across operating systems. The result is a minimal, thread-safe bar that works on Windows, macOS, and Linux without special dependencies. The simplest use case is just telling the bar how many total steps there are, then calling a method to advance it by one each time a step completes. The bar renders in the terminal and updates in place as work progresses. For file downloads or any other situation where data moves through a stream, the library can attach directly to that stream and update the bar automatically as bytes flow through, so you do not need to count anything manually. When the total size of a task is unknown ahead of time (for example, a download where the server does not report a file size), the bar switches automatically into a spinner mode. Spinners animate to show that work is happening without claiming to track how close to done the task is. The library offers several customization options: you can change the color of the bar, its width, the characters used to draw the filled and unfilled portions, and a text label that appears alongside it. A separate options list in the Go documentation covers everything available. The project is licensed under MIT, meaning it is free to use and modify in any project. It has received contributions from several external developers over three major versions, with version 3 being the current one.

Copy-paste prompts

Prompt 1
Using schollz/progressbar, write a Go program that downloads a file from a URL and shows a live progress bar in the terminal.
Prompt 2
How do I add a custom-colored progress bar with a text label to my Go CLI tool using schollz/progressbar?
Prompt 3
I'm writing a Go program that processes files but doesn't know the total count upfront. How do I use schollz/progressbar to show a spinner instead?
Prompt 4
Show me how to attach schollz/progressbar to an io.Reader so it auto-updates as bytes stream through without manual counting.
Open on GitHub → Explain another repo

← schollz on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.