Ruby:基于控制台的菜单 [英] Ruby: Console-based menu
问题描述
我有一个名称和 URL 数组,并希望以向上/向下滚动菜单的形式向用户显示名称列表.基本上是 dialog
在 shell 中允许的内容.
I have an array of Names and URLs and would like to present the user with a list of the names in form of an up-/down-scrollable menu. Basically what dialog
allows within the shell.
我已经研究过 ncurses-ruby
、rdialog
和 HighLine
但它们似乎要么作为项目被放弃,要么甚至抛出错误来自他们的例子(如果存在的话).
I have looked into ncurses-ruby
, rdialog
and HighLine
but they all seem to be either abandoned as a project or throw errors even from their examples (if at all existent).
有人可以向我指出一个很好的、可用的 gem 来做 TUI 菜单 或者一个简单的(然后我会是新手......)介绍如何在 Rails 中做到这一点(即可用数据的呈现(=我的数组中有什么))以及如何处理用户的选择?
Could someone kindly point me to either a nice, usable gem that does TUI menus or a simple (I'll be new to this then...) introduction on how to to this in Rails (ie. presentation of available data (=what I have in my array)) and how to handle the user's choice?
谢谢!
推荐答案
我认为您的所有提议都是有效的,然后出现了更多 (n)curses 包装器,以及更先进的框架,例如 rutui, rbcurse(不幸的是不活跃),vedeu 以及其他一些人.
I think all of your proposals are valid, then there come more (n)curses wrappers, and more evolved framworks like rutui, rbcurse (unfortunately not active), vedeu and probably some others.
不过,我现在的看法是hirb 或 highline 既稳定又积极维护.
However, my take for now would be hirb or highline which are both stable and actively maintained.
这篇关于Ruby:基于控制台的菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!