1

When using curl, I've noticed that it outputs to the terminal text that can be then later replaced and updated. This 'dynamic' text output is what I'd like to do.

Specifically:

An execution like: curl http://raw.github.com/someGZippedPackage | gunzip shows the percentage completion and a completion bar in the terminal.

Are there libraries that provide this functionality?

I can use any object-oriented programming language.

Preferably built for either Java or Node.js.

Kaushik Shankar
  • 5,491
  • 4
  • 30
  • 36
  • I don't understand what you mean with `This 'dynamic' text output is what I'd like to do.` Can you clarify what you're looking for? Curl will retrieve html pages, and either dump them to file(s) or display them as text. – Henk Langeveld Aug 05 '12 at 11:49
  • Thanks for pointing out my ambiguity; I've edited my response and hopefully it is better. – Kaushik Shankar Aug 05 '12 at 18:41

2 Answers2

2

You can probably hack something together using the javacurses library, available here. http://sourceforge.net/projects/javacurses/

If you haven't used curses before, it can be used to provide an interface similar to the one you might see in the BIOS menu. It is the standard way to program menu driven text interfaces, and works for other applications as well.

Here's a solid intro to programming with curses, although actually written for the c library. http://invisible-island.net/ncurses/ncurses-intro.html

Basically move a "cursor" around with move and add characters with addch, then refresh the screen.

Godspeed.

rfinz
  • 372
  • 6
  • 14
1

This is called a progress bar, which can be generated without curses, by using backspace and carriage return characters.

This makes your question a duplicate of Command line progress bar in Java

Community
  • 1
  • 1
Henk Langeveld
  • 8,088
  • 1
  • 43
  • 57