[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] HighLine 0.6.0 -- Now with menus!

James Gray

5/20/2005 9:47:00 PM

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...
Documentation: http://highline.ruby...
Downloads: http://rubyforge.org/frs/?gr...

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&relea...

HighLine can also be installed manually. Just download the latest
release and follow the instructions in INSTALL:

http://rubyforge.org/frs/?gr...&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



17 Answers

Vincent Foley

5/20/2005 10:15:00 PM

0

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

greg7224

5/20/2005 10:32:00 PM

0

Can't stop this train from rollin' :)

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

Its Me

5/21/2005 2:10:00 AM

0


"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?


greg7224

5/21/2005 2:12:00 AM

0

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.

Brian Schröder

5/21/2005 1:24:00 PM

0

On 21/05/05, Greg Brown <greg7224@gmail.com> wrote:
> Can't stop this train from rollin' :)
>
> 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 :)
>
>

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

--
http://ruby.brian-sch...

Stringed instrument chords: http://chordlist.brian-sch...


greg7224

5/21/2005 1:53:00 PM

0

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! :)

Its Me

5/21/2005 6:44:00 PM

0

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.rub...
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...
> Documentation: http://highline.ruby...
> Downloads: http://rubyforge.org/frs/?gr...
>
> 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&relea...
>
> HighLine can also be installed manually. Just download the latest
> release and follow the instructions in INSTALL:
>
> http://rubyforge.org/frs/?gr...&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
>
>
>


greg7224

5/21/2005 7:55:00 PM

0

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

James Gray

5/22/2005 5:02:00 PM

0

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?

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

Thanks.

James Edward Gray II


James Gray

5/22/2005 5:14:00 PM

0

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?

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