Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use (n)curses in Ruby?

Tags:

unix

ruby

curses

I'd like to create a progress bar to indicate the status of an a batch job in Ruby.

I've read some tutorials / libraries on using (n)curses, none of which were particularly helpful in explaining how to create an "animated" progress bar in the terminal or using curses with Ruby.

I'm already aware of using a separate thread to monitor the progress of a given job, I'm just not sure how to proceed with drawing a progress bar.


Update

ProgressBar class was incredibly straight-forward, perfectly solved my problem.

like image 616
Jake McGraw Avatar asked Aug 04 '08 14:08

Jake McGraw


People also ask

What is ruby curses?

Description. A Ruby binding for curses, ncurses, and PDCurses. curses is an extension library for text UI applications. Formerly part of the Ruby standard library, curses was removed and placed in this gem with the release of Ruby 2.1.0. (

What is Ncurses library Linux?

Ncurses is a programming library providing an API, allowing the programmer to write text-based user interfaces, Text User Interface (TUI), in a terminal-independent manner. It also optimizes screen changes, in order to reduce the latency experienced when using remote Unix shell.


1 Answers

You might be able to get some implementation ideas from the Ruby/ProgressBar library, which generates text progress bars. I stumbled across it a couple of months back but haven't made any use of it.

like image 87
Joey deVilla Avatar answered Nov 05 '22 06:11

Joey deVilla