Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] GetOptions 0.1 released
Delaney Parker
12/1/2007 12:05:00 AM
GetOptions - Yet another command line argument parser for Ruby. Inspired
by Perl's Getopt::Long module, the GetOptions module provides a fairly
powerful POSIX-ish option parser that is very easy to learn and use.
http://rubyforge.org/projects/g...
A quick and dirty example...
--
$ cat example.rb
require 'getoptions'
opt = GetOptions.new(%w(help debug! verbose+ prefix:s size=i host=@s))
p opt
--
$ ./example.rb --help
:help: true
$ ./example.rb --debug
:debug: true
$ ./example.rb --no-debug
:debug: false
$ ./example.rb -vvvvv
:verbose: 5
$ ./example.rb -vv --verbose
:verbose: 3
$ ./example.rb --pre
:prefix: nil
$ ./example.rb --pre myprefix
:prefix: "myprefix"
$ ./example.rb --size 5
:size: 5
$ ./example.rb --host foo bar baz
:host: ["foo", "bar", "baz"]
Give it a whirl and let me know what you think.
Enjoy,
Delaney
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] GetOptions 0.1 released
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password