是否有一个命令行框架的ruby? [英] Is there a command line framework for ruby?

查看:112
本文介绍了是否有一个命令行框架的ruby?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,有Web框架,有GUI框架,我只是想知道是否有一个控制台/命令行框架的ruby?

So, there are web frameworks, there are GUI frameworks, I was just wondering if there was a console/command line framework for ruby?

具体来说,喜欢能够:


  1. 有一个特定的视图,其中我可以标签到不同的输入段。

  2. 我想使用常用的控制台快捷键(ctr-k,ctr-a,ctr-e等)。

  3. 如果光标在某个输入位置,有时候我想要响应单个按键事件,而不是我必须输入文本,然后按enter键。

不必是一个统一的框架。但我注意到,它似乎有点繁琐,在Ruby中写控制台应用程序。

Does not have to be a unified framework. But I notice that it does seem somewhat cumbersome to write console apps in ruby. Are there any tools that make this easier?

推荐答案

从你的问题来看,这听起来像是你喜欢寻找基于curses的框架。但是,如果你不是,这里有一些控制台/ irb相关的宝石我写的可能是有用的:

Judging from your questions it sounds like your like looking for curses-based frameworks. But in case that you're not, here are some console/irb-related gems I've written that may be useful:


  • < a href =http://github.com/cldwalker/hirb#readme =nofollow noreferrer> hirb - 用于将类与视图相关联的视图框架

  • < a href =http://github.com/cldwalker/bond#readme =nofollow noreferrer> bond - custom readline completion make easy

  • boson - 控制台命令框架

  • hirb - view framework for associating classes with views
  • bond - custom readline completion made easy
  • boson - console command framework

现在回答你的问题:


  1. 虽然我不知道该怎么做,但这个好的curses应用程序,其源代码可以阅读。

  2. require' readline'给你那些键绑定

  3. require'highline'; answer = HighLine.new.ask('ask something'){| e | e.character = true}

  1. Though I don't know how to do it, there is this nice curses app whose source code you could read.
  2. require 'readline' gives you those keybindings
  3. require 'highline'; answer = HighLine.new.ask('ask something') {|e| e.character = true }

这篇关于是否有一个命令行框架的ruby?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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