2

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.

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).

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?

Thank you!

2 Answers 2

2

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.

However, my take for now would be hirb or highline which are both stable and actively maintained.

Sign up to request clarification or add additional context in comments.

Comments

1

Green shoes is a nice gem for this kind of work, it has menu's, selects, editboxes, filedialogs, checkboxes etc while being simple and having no dependencies other than Ruby itself.

There is a small but very active community with a mailing list to ask for help. See http://vgoff.posterous.com/green-shoes for more info. Installation is with gem install green_shoes

Here a small example

Shoes.app title: 'Selecteer vakantie', height: 600 do
  background lightgreen..lightskyblue, :angle => 30
  @list = ["choice1","choice2"]
  @result = []
  stack do
    para "Make your choice.", font: "sans", size: 10
    flow do
      button "Ok" do
        selected = @list.map{|c, n| n if c.checked?}.compact
        @result[0].text = "you selected #{selected}"
      end
      button("End") {exit}
    end
    @list.map! do |name|
      flow { @c = check; para name, width: 500, font: "sans", size: 10 }
      [@c, name]
    end
    @result << para('', :stroke => forestgreen)
  end
end

2 Comments

I might be mistaken (currently I am still trying to build Green Shoes under OS X, theres quite q few dependencies to natively build it :) but this appears to be a GUI gem. I was looking for a Text based User Interface, aka. something ncurses/dialog-like. But a nice thing to look into anyways!
ah, in windows with the installer it is all included, most of the time it is the opposite and we have more work to get it to work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.