Ruby Dialog Interface
Interface with the command-line curses interface dialog, and rapidly develop simple dialog-driven TUI applications
Install dialog on your machine.
sudo gem install rdialog
After installation is complete, require the gem in your source code, and away you go!
RDialog handles the interface between ruby scripts and dialog’s command-line interface. RDialog accepts input as arrays and/or strings, and returns similar objects.
Once you have initialized an instance of RDialog via
RDialog.new, options can be set that will persist throughout the lifetime of the instace. For example:
dialog = RDialog.new dialog.shadow = false
This will prevent dialog from drawing shadows around all further boxes.
Demonstration of usage
require "rdialog" items = Array.new items.push(["softcheese.net", "a cool server", false]) items.push(["filter.eu.org", "an even cooler server!", false]) items.push(["oink.me.uk", "quite cool as well", true]) dialog = RDialog.new dialog.nocancel = true selected_item = dialog.radiolist("ssh to:", items) exec("ssh sweeper@" + selected_item)
This code is free to use under the terms of the MIT licence.
Comments are welcome. Send an email to Aleks Clark.