HighLine 0.6.0 Released
···
=======================
The latest version of HighLine comes with two massive new features. The first is the new HighLine Developer, Greg Brown. Now if you don't believe me that Greg is a major new feature, just look what he did...
The second major new feature of this release is the complete HighLine menuing system designed and built by Greg Brown (with minimal input from James)! You heard that right, we've had multiple requests for this one and the wait is now over. HighLine is ready for menus, from simple to complex:
# Simple...
case choose(:iterate, :recurse) # HighLine code begins and ends here!
when :iterate
# whatever (using iteration)...
when :recurse
# whatever (recursively)...
end
# Getting fancier -- action code and index customization...
choose do |menu|
menu.index = :letter
menu.index_suffix = ") "
menu.prompt = "Please choose your favorite programming language? "
menu.choice :ruby do say("Good choice!") end
menu.choices(:python, :perl) do say("Not from around here, are you?") end
end
# Just plain fun -- shells in HighLine!
loop do
choose do |menu|
menu.layout = :menu_only
menu.shell = true
menu.case = :capitalize
menu.choice :Load do |command, details|
say("Loading file with options: #{details}...")
end
menu.choice :Save do |command, details|
say("Saving file with options: #{details}...")
end
menu.choice(:Quit) { exit }
end
end
There's more folks. That was just a tease. Do look into all the features choose() offers.
In addition, we've implemented other feature requests like echo = "*" and fixed every known bug! Also, true to my word, someone (Greg again!) pointed out a flaw with the "stty" implementation, so we switched to "termios" as has been discussed on this list. However, if you have any trouble getting "termios" installed, HighLine will just default to the old system (and we even improved that!).
As you can see, it's quite a release. If you've held off on taking a look at HighLine, now is the time!
See documentation and examples for more details.
If anyone uses this, feedback is welcome (james@grayproductions.net). We do have a TODO list of features we would like to add, but we're also open to suggestions.
If you have any trouble with character reading or echo, especially on Windows, please let me know.
What is HighLine?
-----------------
(from the README)
HighLine was designed to ease the tedious tasks of doing console input and output with low-level methods like gets() and puts(). HighLine provides a robust system for requesting data from a user, without needing to code all the error checking and validation rules and without needing to convert the typed Strings into what your program really needs. Just tell HighLine what you're after, and let it do all the work.
What's new in this release?
---------------------------
(highlights from the CHANGELOG)
* Implemented HighLine.choose() for menu handling.
* Provided shortcut choose(item1, item2, ...) for simple menus.
* Allowed Ruby code to be attached to each menu item, to create a complete
menu solution.
* Provided for total customization of the menu layout.
* Allowed for menu selection by index, name or both.
* Added a shell mode to allow menu selection with additional details
following the name.
* Added support for echo = "*" style settings. User code can now
choose the echo character this way.
* Modified HighLine to user the "termios" library for character input, if
available. Will return to old behavior (using "stty"), if "termios" cannot be
loaded.
* Improved "stty" state restoring code.
* Fixed "stty" code to handle interrupt signals.
Plus documentation and examples for the new features. We also fixed all reported bugs!
Where can I learn more?
-----------------------
HighLine is hosted on RubyForge.
Project page: http://rubyforge.org/projects/highline/
Documentation: http://highline.rubyforge.org/
Downloads: http://rubyforge.org/frs/?group_id=683
How do I get HighLine?
----------------------
HighLine is a gem, so as long as you have RubyGems installed it's as simple as:
$ sudo gem install highline
If you need to install RubyGems, you can download it from:
http://rubyforge.org/frs/?group_id=126&release_id=1885
HighLine can also be installed manually. Just download the latest release and follow the instructions in INSTALL:
http://rubyforge.org/frs/?group_id=683&release_id=2211
Our Thanks!
-----------
We want to thank all the people that have helped make this library something genuinely useful:
Ryan Leavengood
Vincent Foley
Mark Hubbart
Andre Nathan
Martin DeMello
YANAGAWA Kazuhisa
Thanks so much for the feedback, bug reports, and wonderful tips and tricks!
James Edward Gray II
Greg Brown