我如何在 Ruby 中使用 (n)curses? [英] How do I use (n)curses in Ruby?

查看:38
本文介绍了我如何在 Ruby 中使用 (n)curses?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个进度条来指示 Ruby 中批处理作业的状态.

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

我读过一些教程/<关于使用 (n)curses 的 href="http://ncurses-ruby.berlios.de/" rel="noreferrer" title="ncurses-ruby">库,无其中对于解释如何在终端中创建 动画" 进度条或在 Ruby 中使用curses 尤其有用.

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.

更新

ProgressBar 类非常简单,完美地解决了我的问题.

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

推荐答案

你或许可以从 Ruby/ProgressBar 库,用于生成文本进度条.几个月前我偶然发现了它,但没有使用过它.

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.

这篇关于我如何在 Ruby 中使用 (n)curses?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆