# GetOptions 0.1 released

**URL:** <https://www.ruby-forum.com/t/getoptions-0-1-released/121802>\
**Category:** Ruby\
**Created:** [December 1, 2007, 1:10am UTC](https://www.ruby-forum.com/t/getoptions-0-1-released/121802 "2007-12-01T01:10:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Delaney\_Parker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e99b99/32.png) [@Delaney\_Parker](https://www.ruby-forum.com/u/Delaney_Parker)\
**Post date:** [December 1, 2007, 1:10am UTC](https://www.ruby-forum.com/t/getoptions-0-1-released/121802/1 "2007-12-01T01:10:42Z")

</div>

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/getoptions/](http://rubyforge.org/projects/getoptions/)

## 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
