progressbar

一个易于使用的 C 语言库,用于显示文本进度条。「An easy-to-use C library for displaying text progress bars.」

Github星跟踪图

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:

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

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.

主要指标

概览
名称与所有者doches/progressbar
主编程语言C
编程语言Makefile (语言数: 4)
平台
许可证BSD 3-Clause "New" or "Revised" License
所有者活动
创建于2010-05-06 21:56:40
推送于2023-05-02 18:11:31
最后一次提交2020-12-23 12:56:56
发布数0
用户参与
星数471
关注者数21
派生数55
提交数84
已启用问题?
问题数6
打开的问题数2
拉请求数23
打开的拉请求数3
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?