Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doches/progressbar
An easy-to-use C library for displaying text progress bars.
https://github.com/doches/progressbar
c command-line-tools hacktoberfest
Last synced: 1 day ago
JSON representation
An easy-to-use C library for displaying text progress bars.
- Host: GitHub
- URL: https://github.com/doches/progressbar
- Owner: doches
- License: bsd-3-clause
- Created: 2010-05-06T21:56:40.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2023-05-02T18:11:31.000Z (over 1 year ago)
- Last Synced: 2024-12-16T07:20:54.390Z (9 days ago)
- Topics: c, command-line-tools, hacktoberfest
- Language: C
- Homepage:
- Size: 175 KB
- Stars: 468
- Watchers: 22
- Forks: 53
- Open Issues: 5
-
Metadata Files:
- Readme: README.mdown
- License: LICENSE
Awesome Lists containing this project
README
## What is this thing?
progressbar is a C-class (it's a convention, dammit) for displaying attractive
progress bars on the command line. It's heavily influenced by the ruby ProgressBar
gem, whose api and behaviour it imitates.## Ok, what the hell is a C-class, and how do I use one?
progressbar is implemented in pure C99, but using a vaguely object-oriented convention.
Example usage:
```c
progressbar *progress = progressbar_new("Loading",100);
for(int i=0; i < 100; i++)
{
// Do some stuff
progressbar_inc(progress);
}
progressbar_finish(progress);
```Example output (from `progressbar_demo.c`):
![demo output](example_output/demo.png)
Additional examples can be found in `test/progressbar_demo.c`
## Why did you do this?
One of the things I miss most when I'm writing C instead of Ruby is the
how ridiculously easy it is to write user-friendly, informative CLI apps
in Ruby. A big part of that, at least for me, is the ProgressBar gem --
and since most of the time when I'm writing C I'm doing so because I need
a tool to handle some long-running, processor-intensive task, I'd really
like to have a way of seeing at a glance how much time is remaining and
how far along we've gotten. Enter progressbar!## Can I use it?
Of course, if you're so inclined. progressbar is licensed under a simplified BSD license,
so feel free to take it and run with it. Details can be found in the `LICENSE` file.## Why doesn't it compile?
If progressbar fails to build because `termcap.h` isn't found, you're probably missing the ncurses dev libraries.
```
gcc -c -std=c99 -Iinclude lib/progressbar.c
lib/progressbar.c:13:45: fatal error: termcap.h: No such file or directory
compilation terminated.
```