Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command line framework for ruby? [closed]

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

Specifically, I would like to be able to:

  1. Have a particular view wherein I could tab to different input segments. Exactly like you can do with forms on a web page.
  2. I would like the usual console shortcuts to work (ctr-k, ctr-a, ctr-e, etc)
  3. If the cursor is at a certain input position, sometimes I would like it to response to a single key press event, rather than my having to enter text and then press enter.

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?

like image 692
Stephen Cagle Avatar asked Nov 26 '09 20:11

Stephen Cagle


1 Answers

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:

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

Now to answer your questions:

  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 }
like image 121
cldwalker Avatar answered Nov 19 '22 03:11

cldwalker