Getopt-Declare 1.31 released as a gem

Getopt-Declare, the popular argument parsing library (port from a
popular Perl library) is now up to v1.31 and fixes warnings in
ruby2.1.0. And it runs like a speed daemon with it.

You can get it from rubyforge.net or rubygems.org.

https://rubygems.org/gems/getopt-declare
https://rubyforge.org/projects/getoptdeclare

The big advantage of this library is that it makes argument parsing as
close as what you see is what you get. For example:

args = Getopt::Declare.new( <<‘EOARGS’ )
General options:
[tight]
-e <f:i>…<t:i> Set expansion factor to specified range
[requires: ]
{ puts “k = [#{f}…#{t}]” }

 -e [<k:n>...]    Set expansion factor to <k> (or 2 by default)
                    [required]
                            { k = [2] unless k
                              print "k = [", k.join(','), "]\n"; }

-b blen:i Use byte length of
[excludes: -a +c]
{ print “byte len: #{blen}\n”; }

… Process files [required] [implies: -a]
{ print “files: #{file}\n”; }

-a [<n:n>] Process all data [except item ]
{ print “proc all\n”; print “except #{n}\n”
if n }

-fab The fabulous option (is always required :slight_smile:
[required]
{ defer { print “fabulous!\n” } }

File creation options:

+c Create file [mutex: +c -a]
{ print “create: file\n”; }

+d Duplicate file [implies: -a and -b 8]
This is a second line
{ print “dup (+d) $file\n”; }
–dup [ditto] (long form)

-how <n:i> Set height to [repeatable]

Garbling options:

-g [seed:i] Garble output with optional seed [requires: +c]
{ print “garbling with #{seed}\n”; }
-i Case insensitive garbling [required]
{ print “insensitive\n”; }
-s Case sensitive garbling
-w WaReZ m0De 6aRBL1N6

[mutex: -i -s -w]
EOARGS