Giter VIP home page Giter VIP logo

progressbar's Introduction

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.

progressbar's People

Contributors

abrock avatar baruch avatar doches avatar ekg avatar jack126guy avatar johannesbuchner avatar marcomorain avatar michael-hartmann avatar mitmischer avatar nabijaczleweli avatar nibroc avatar rmariano avatar robmul avatar suhussai avatar syndicut avatar thekvs avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

progressbar's Issues

Working with XCode's debug console

Is there a smart way to integrate this ( fanstatic ) library to work with the XCode debug window?

I can get xCode to open Terminal and the Progressbar works as expected. But if you use the Native xCode debug window it prints a non-beautiful progressbar..

Why stderr instead of stdout?

Thanks you guys for your progressbar, I have used it for a school's project where I have to implement a genetic algorithm for solving QAP (Quadratic Assigment Problem), but I have found in the code that you use "stderr" instead of "stdout," why is it?

The progressbar works (I have not tried userbar) because by default stderr = stdout. I mean, if I run my application and redirect the error output to some log file (as many Lignux (GNU/Linux) applications do - usually /var/log/ directory), the progressbar will not be displayed in the terminal. I think that it will be better to change "stderr" by "stdout."

Thanks.

Undefined symbols for architecture x86_64 Error

I'm getting the below error when compiling in my project when statically linking with the progressbar lib:

Undefined symbols for architecture x86_64:
  "_tgetent", referenced from:
      _get_screen_width in libprogressbar.a(progressbar.o)
  "_tgetnum", referenced from:
      _get_screen_width in libprogressbar.a(progressbar.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin] Error 1

I'm on a 2019 macbook running Catalina 10.15.6.
I Tried to use the -m64 arg when building my code with the progressbar lib but havent yet tried this flag when building the progressbar project directly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.