50 lines
1.5 KiB
Markdown
50 lines
1.5 KiB
Markdown
# progressbar
|
|
|
|
[](https://travis-ci.org/schollz/progressbar)
|
|
[](https://goreportcard.com/report/github.com/schollz/progressbar)
|
|

|
|
[](https://godoc.org/github.com/schollz/progressbar)
|
|
|
|
A very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for [croc](https://github.com/schollz/croc) and everything I tried had problems, so I made another one.
|
|
|
|

|
|
|
|
## Install
|
|
|
|
```
|
|
go get -u github.com/schollz/progressbar
|
|
```
|
|
|
|
## Usage
|
|
|
|
**Basic usage:**
|
|
|
|
```golang
|
|
bar := progressbar.New(100)
|
|
for i := 0; i < 100; i++ {
|
|
bar.Add(1)
|
|
time.Sleep(10 * time.Millisecond)
|
|
}
|
|
```
|
|
|
|
which looks like:
|
|
|
|
```bash
|
|
100% |████████████████████████████████████████| [1s:0s]
|
|
```
|
|
|
|
The times at the end show the elapsed time and the remaining time, respectively.
|
|
|
|
## Contributing
|
|
|
|
Pull requests are welcome. Feel free to...
|
|
|
|
- Revise documentation
|
|
- Add new features
|
|
- Fix bugs
|
|
- Suggest improvements
|
|
|
|
## License
|
|
|
|
MIT
|