Sha256: 11b0250ec58b6b3fc72d50b70b43021779c80e49b9570da050a5e63b9554cf8b

Contents?: true

Size: 403 Bytes

Versions: 13

Compression:

Stored size: 403 Bytes

Contents

# Require the OptionParser code.
require 'optparse'
# Create an OptionParser object.
parser = OptionParser.new
# Define one or more options.
parser.on('-x', 'Whether to X') do |value|
  p ['x', value]
end
parser.on('-y', 'Whether to Y') do |value|
  p ['y', value]
end
parser.on('-z', 'Whether to Z') do |value|
  p ['z', value]
end
# Parse the command line and return pared-down ARGV.
p parser.parse!

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
optparse-0.6.0 doc/optparse/ruby/basic.rb
optparse-0.5.0 doc/optparse/ruby/basic.rb
cli-option_parser.rb-0.6.0 doc/optparse/ruby/basic.rb
cli-option_parser.rb-0.5.3 doc/optparse/ruby/basic.rb
cli-option_parser.rb-0.5.2 doc/optparse/ruby/basic.rb
cmd-optparse.rb-0.5.2 doc/optparse/ruby/basic.rb
cmd-optparse.rb-0.5.0 doc/optparse/ruby/basic.rb
cmd-optparse.rb-0.1.1 doc/optparse/ruby/basic.rb
cmd-optparse.rb-0.1.0 doc/optparse/ruby/basic.rb
optparse-0.4.0 doc/optparse/ruby/basic.rb
optparse-0.3.1 doc/optparse/ruby/basic.rb
optparse-0.3.0 doc/optparse/ruby/basic.rb
optparse-0.2.0 doc/optparse/ruby/basic.rb