Add a progress bar to a Go CLI tool that processes files one by one.
Show real-time download progress when fetching files in a Go program.
Display a spinner when running a task of unknown total length in the terminal.
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.
← schollz on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.