[ANN] HighLine 0.6.0 -- Now with menus!

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

Wow, I go away for about a week and BAM, all the work's done! I guess
I better start working on something else in the system :slight_smile:

I get an install error on termios. Highline does not install (regardless of
y/n to termios installation). Running Win-XP, gem 0.8.10.

Anything different I should try?

C:\>gem install highline
Attempting local installation of 'highline'
Local gem file not found: highline*.gem
Attempting remote installation of 'highline'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency termios? [Yn] y
Building native extensions. This could take a while...
ERROR: While executing gem ... (RuntimeError)
    ERROR: Failed to build gem native extension.
Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.8/gems/termios-0.9.4 for inspection.
  ruby extconf.rb install highline\nchecking for termios.h... no

Results logged to c:/ruby/lib/ruby/gems/1.8/gems/termios-0.9.4/gem_make.out

"James Edward Gray II" <james@grayproductions.net> wrote in message
news:BFA34C69-3D69-41D9-AF1B-0AAE285E85F8@grayproductions.net...

···

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

Can't stop this train from rollin' :slight_smile:

Seriously though, James grossly understated his contributions to the
menu system.
We both did a lot of work to get this release out, and also, the stuff
that you
offered us helped substantially as well.

Anyone who is out there that hasn't checked out HighLine before, we
urge you to do so.
And please feel free to make requests, seeing as we met all of them to
date in this release, we'll be happy if you fill our plates back up.

Hope you guys have as much fun using HighLine as we have had building
it so far :slight_smile:

Hmm... James does all the packaging, so I'm not so sure about this one.
Has anyone else had this problem? Does anyone know whats wrong? I
don't have any Windows computers anywhere near me, otherwise I'd dig in
and play around and try to figure out what the problem is. I know
termios is a C extension, and that can be the source of the problem. I
don't know anything about Windows XP and permissions but if you don't
have administrative access, that could be a problem. In the mean time,
you can try installing highline via setup.rb. Just download the zip
file from http://rubyforge.org/frs/download.php/4511/highline-0.6.0.zip
and type ruby setup.rb in the base directory. This should work without
termios / rubygems. I've emailed james and let him know about this, so
hopefully he'll post an answer soon.

Wish I wasn't so dumb with Windows, but it's been years since I
switched to Linux :wink:

Sorry for the delay, I was out of town yesterday.

I'm aware of the problem now and in search of a good fix. I'll update HighLine as soon as I find it...

Thanks for bringing this to my attention.

James Edward Gray II

···

On May 21, 2005, at 1:45 PM, itsme213 wrote:

I get an install error on termios. Highline does not install (regardless of
y/n to termios installation). Running Win-XP, gem 0.8.10.

Anything different I should try?

C:\>gem install highline
Attempting local installation of 'highline'
Local gem file not found: highline*.gem
Attempting remote installation of 'highline'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency termios? [Yn] y
Building native extensions. This could take a while...
ERROR: While executing gem ... (RuntimeError)
    ERROR: Failed to build gem native extension.
Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.8/gems/termios-0.9.4 for inspection.
  ruby extconf.rb install highline\nchecking for termios.h... no

Results logged to c:/ruby/lib/ruby/gems/1.8/gems/termios-0.9.4/gem_make.out

You do not need termios for Windows, so you might try:
gem install highline --ignore-dependencies

HTH

"Greg Brown" <greg7224@gmail.com> wrote in message

And please feel free to make requests, seeing as we met all of them to
date in this release, we'll be happy if you fill our plates back up.

TAB-completion a'la the Cmd gem. Or is it in there already?

Thanks, it really sounds great. If you want something more on the
plates, I'd offer internationalization. And have you checked if it is
utf-8 compatible?

regards,

Brian

···

On 21/05/05, Greg Brown <greg7224@gmail.com> wrote:

Can't stop this train from rollin' :slight_smile:

Seriously though, James grossly understated his contributions to the
menu system.
We both did a lot of work to get this release out, and also, the stuff
that you
offered us helped substantially as well.

Anyone who is out there that hasn't checked out HighLine before, we
urge you to do so.
And please feel free to make requests, seeing as we met all of them to
date in this release, we'll be happy if you fill our plates back up.

Hope you guys have as much fun using HighLine as we have had building
it so far :slight_smile:

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/

You do not need termios for Windows, so you might try:
gem install highline --ignore-dependencies

tried that, got this...

C:/Work/active/shell/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:194:in
`report_activate_error': Could not find RubyGem termios (>= 0.9.4)
(Gem::LoadError)

···

On 5/22/05, Greg Brown <greg7224@gmail.com> wrote:

HTH

--
Bill Guindon (aka aGorilla)

Tab completion is not supported yet, but autocomplete is.

So if you have a menu item quit, typing q will work
if it cannot figure out what you mean, it will tell you that the
command was ambiguous.

We'll see if we can put tab completion in a future release.

I'll be honest, if James has he hasn't mentioned it to me, so I'll look
into it. My guess is that it's a 'no' unless we did it by chance.
Sounds like something for a future release though. It's still his
project, so I'm waiting for him to okay it, but both tab completion and
internationalization sound like great ideas to me! :slight_smile:

Good idea. I've added it to the TODO and will look into it.

Thanks.

James Edward Gray II

···

On May 20, 2005, at 9:10 PM, itsme213 wrote:

"Greg Brown" <greg7224@gmail.com> wrote in message

And please feel free to make requests, seeing as we met all of them to
date in this release, we'll be happy if you fill our plates back up.

TAB-completion a'la the Cmd gem. Or is it in there already?

Here are the relevant details I can think of in regards to this:

1. HighLine's data set is Ruby Strings (input and output).
2. User code provides the output.
3. End users respond to provide the input.
4. When HighLine manipulates these Strings, it happens in one of two way: Strings are modified based on two whitespace characters (space and newline). Strings are also modified as directed by user code (asking HighLine to call capitalize() for you, for example).
5. While they all have (English) defaults, any message HighLine displays can be set to whatever the user code feels is best.

To me, the above means that HighLine is almost as internationalized as ordinary Ruby Strings, but please do correct me if I'm wrong!

If you discover and specific issues with internationalization support, send us the bug report and we'll do our best to fix it.

James Edward Gray II

···

On May 21, 2005, at 8:23 AM, Brian Schröder wrote:

Thanks, it really sounds great. If you want something more on the
plates, I'd offer internationalization. And have you checked if it is
utf-8 compatible?

Hmmm ... I get:

  $ sudo gem install highline --ignore-dependencies
  Attempting local installation of 'highline'
  Local gem file not found: highline*.gem
  Attempting remote installation of 'highline'
  Successfully installed highline-0.6.0
  Installing RDoc documentation for highline-0.6.0...

I'll try on windows tomorrow at work. (BTW, what version of RubyGems are you
running?)

···

On Sunday 22 May 2005 11:01 pm, Bill Guindon wrote:

On 5/22/05, Greg Brown <greg7224@gmail.com> wrote:
> You do not need termios for Windows, so you might try:
> gem install highline --ignore-dependencies

tried that, got this...

C:/Work/active/shell/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:194:in
`report_activate_error': Could not find RubyGem termios (>= 0.9.4)
(Gem::LoadError)

> HTH

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

> > You do not need termios for Windows, so you might try:
> > gem install highline --ignore-dependencies
>
> tried that, got this...
>
> C:/Work/active/shell/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:194:in
> `report_activate_error': Could not find RubyGem termios (>= 0.9.4)
> (Gem::LoadError)
>
> > HTH

Hmmm ... I get:

  $ sudo gem install highline --ignore-dependencies
  Attempting local installation of 'highline'
  Local gem file not found: highline*.gem
  Attempting remote installation of 'highline'
  Successfully installed highline-0.6.0
  Installing RDoc documentation for highline-0.6.0...

I'll try on windows tomorrow at work. (BTW, what version of RubyGems are you
running?)

Should clarify a bit...
the install itself went smooth, got the error when I did the requires:

require 'rubygems'
require_gem 'highline'

gem -v returns: 0.8.10

···

On 5/22/05, Jim Weirich <jim@weirichhouse.org> wrote:

On Sunday 22 May 2005 11:01 pm, Bill Guindon wrote:
> On 5/22/05, Greg Brown <greg7224@gmail.com> wrote:

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

--
Bill Guindon (aka aGorilla)

James is working on the problem. It appears that our gem is insisting
that Windows users install termios, which they do not need. In the
mean time, I suggest that Windows users use setup.rb to install
HighLine until we fix the problem. Ugh... this is why he was hesitant
add a dependency in the first place. What would be nicer is if someone
could figure out how to prevent stty from failing and letting some keys
through, so we could use that. Sorry that you're having some trouble,
as neither James nor I are well versed in Windows issues, if anyone
knows how to repackage the software so that this does not happen,
please email James or me on or off list and we'll get a fix out as soon
as we can. Has anyone had any trouble using setup.rb? To the best of
my knowledge, this should install 0.6.0 without issues.

Worked fine via setup.rb

···

On 5/23/05, Greg Brown <greg7224@gmail.com> wrote:

James is working on the problem. It appears that our gem is insisting
that Windows users install termios, which they do not need. In the
mean time, I suggest that Windows users use setup.rb to install
HighLine until we fix the problem. Ugh... this is why he was hesitant
add a dependency in the first place. What would be nicer is if someone
could figure out how to prevent stty from failing and letting some keys
through, so we could use that. Sorry that you're having some trouble,
as neither James nor I are well versed in Windows issues, if anyone
knows how to repackage the software so that this does not happen,
please email James or me on or off list and we'll get a fix out as soon
as we can. Has anyone had any trouble using setup.rb? To the best of
my knowledge, this should install 0.6.0 without issues.

--
Bill Guindon (aka aGorilla)