Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail From: Lee Jarvis Newsgroups: comp.lang.ruby Subject: [ANN] Slop 1.5.0 Date: Sat, 16 Apr 2011 13:52:32 -0500 Organization: Service de news de lacave.net Lines: 45 Message-ID: NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1302979971 90429 65.111.164.187 (16 Apr 2011 18:52:51 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Sat, 16 Apr 2011 18:52:51 +0000 (UTC) X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381714 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3023 Slop ==== Slop is a simple option parser with an easy to remember syntax and friendly API. Github: http://github.com/injekt/slop Documentation: http://rubydoc.info/github/injekt/slop/master Slop 1.5 introduces commands. Commands allow you to create nested Slop objects. See an example here: https://gist.github.com/923386 Installation ------------ ### Rubygems gem install slop ### GitHub git clone git://github.com/injekt/slop.git gem build slop.gemspec gem install slop-.gem Usage ----- # parse assumes ARGV, otherwise you can pass it your own Array opts = Slop.parse do on :v, :verbose, 'Enable verbose mode' # boolean value on :n, :name, 'Your name', true # compulsory argument on :s, :sex, 'Your sex', :optional => false # the same thing on :a, :age, 'Your age', :optional => true # optional argument end # if ARGV is `-v --name 'lee jarvis' -s male` opts.verbose? #=> true opts.name? #=> true opts[:name] #=> 'lee jarvis' opts.age? #=> false opts[:age] #=> nil -- Posted via http://www.ruby-forum.com/.