Trollop 1.10 released

I released a new version of Trollop with a couple minor but cool updates.

The best part is the new :io argument type, which uses open-uri to handle filenames and URIs on the commandline. So you can do something like this:

require 'trollop'

opts = Trollop::options do
opt :source, "Source file (or URI) to print",
:type => :io,
:required => true
end

opts[:source].each { |l| puts "> #{l.chomp}" }


Also, when trying to detect the terminal size, Trollop now tries to `stty size` before loading curses. This gives better results when running under screen (for some reason curses clears the terminal when initializing under screen).

I've also cleaned up the documentation quite a bit, expanding the examples on the main page, fixing up the RDoc comments, and generating the RDoc documentation with a modern RDoc, so that things like constants actually get documented.

If you're still using OptParse, you should really give Trollop a try. I guarantee you'll write much fewer lines of argument parsing code, and you'll get all sorts of nifty features like help page terminal size detection.

0 comments:

Blog Archive