Odkazy:
# Mandatory argument.
opts.on("-r", "--require LIBRARY", "Require the LIBRARY before executing your script") do |lib|
        options.library << lib
endOptional argument; multi-line description.
opts.on("-i", "--inplace [EXTENSION]", "Edit ARGV files in place",
                                       "  (make backup if EXTENSION supplied)") do |ext|
        …
end# Another typical switch to print the version.
opts.on_tail("--version", "Show version") do
        puts OptionParser::Version.join('.')
        exit
endV dalším emailu je následující ukázka:
require 'rubygems'
require 'commandline'
class MyApp < CommandLine::Application
  def initialize
    # Mandatory argument
    option :names => %w(--require -r),
               :opt_description => "Require the LIBRARY "+
                                            "before executing your 
script",
               :arg_description => "LIBRARY",
               :opt_found => get_arg,
               :opt_not_found => required
    option :names => %w(--inplace -i),
               :arity => [0,1],
               :opt_description => "Edit ARGV files in place",
               :arg_description => "[EXTENSION]",
               :opt_found => get_arg,
  end
  def main
    #put your code here
    p opts
  end
end#class MyAppopts.parse!(args)
