LICENSE

This release is licensed under the RLL - Ruby Lovers License. If you don’t love Ruby, then you don’t have permission to even think about using/reading/ opening any file in this project.

If you a lover of Ruby, then you may use this freely and pay for your use by giving feedback to the author, Jim Freeze.

CommandLine::OptionParser

ABOUT

CommandLine::OptionParser is part of the CommandLine suite of tools and is used for command line parsing. The parser integrates with CommandLine::Option, CommandLine::OptionData and CommandLine::Application.

The parser supports POSIX, Gnu and XTools style parsing options. It also gives you flexibility to provide non standard options. For example:

POSIX

OptionParser.new Option.new(:names => “-f”)

Gnu

OptionParser.new Option.new(:names => %w[–file -f])

XTools

OptionParser.new Option.new(:names => “-file”)

User

OptionParser.new(Option.new(

:names => %w(--file -file --files -files -f),
:arg_arity => [1,-1],
:arg_description => "file1 [file2, ...]"))

This option parser with a single option prints:

OPTIONS

    --file,-file,--files,-files,-f file1 [file2, ...]

There is document describing the various usage scenarios at its homepage.

After poking around in a few corporations, it was evident that option parsing was not understood. Nevertheless, many tools were built that did not conform to any of the POSIX, Gnu or XTools option styles. CommandLine::OptionParser was developed so that new application could be written that conformed to accepted standards, but non-standard option configurations could be handled as well to support legacy interfaces.

More information on OptionParser can be found on its homepage: optionparser.rubyforge.org

Major Features - 06/07/2005

  • First public release 0.5.0

Thanks for all the feedback!

Download & Installation

Homepage: optionparser.rubyforge.org Download: rubyforge.org/frs/?group_id=296

Dependencies:

  • None

There are many ways to install optionparser. Choose the one you like best:

Via RubyGems

$ gem install optionparser

# not in RPA yet Via RPA

$ rpa install optionparser

# this either The do-it-yourself way

$ ruby setup.rb config
$ ruby setup.rb setup
$ ruby setup.rb install

# nor this The simplified do-it-yourself way

$ rake install

Integration with Application

class MyApp << CommandLine::Application

end