3 by William Morgan (http://masanjin.net/)
5 Main page: http://trollop.rubyforge.org
7 Release announcements and comments: http://masanjin.net/blog/label/trollop/.
9 Documentation quickstart: See Trollop.options and then Trollop::Parser#opt.
10 Also see the examples at http://trollop.rubyforge.org/.
14 Trollop is a commandline option parser for Ruby that just gets out of your way.
15 One line of code per option is all you need to write. For that, you get a nice
16 automatically-generated help page, robust option parsing, and sensible defaults
17 for everything you don't specify.
22 - Single file. Throw it in lib/ if you don't want to make it a Rubygem dependency.
23 - Sensible defaults. No tweaking necessary, much tweaking possible.
24 - Support for long options, short options, subcommands, and automatic type validation and
26 - Automatic help message generation, wrapped to current screen width.
30 * A burning desire to write less code.
39 opts = Trollop::options do
40 opt :monkey, "Use monkey mode" # flag --monkey, default false
41 opt :name, "Monkey name", :type => :string # string --name <s>, default nil
42 opt :num_limbs, "Number of limbs", :default => 4 # integer --num-limbs <i>, default to 4
45 p opts # a hash: { :monkey=>false, :name=>nil, :num_limbs=>4, :help=>false }
49 Copyright (c) 2008--2012 William Morgan. Trollop is distributed under the same