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 or

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 = <<‘EOARGS’ )
General options:
-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)
                            { 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:
{ 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]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs