Sha256: b391644465a3caf022d78e04713c0d5e7a76a9cfdb9d77c0d7093404f58752a3

Contents?: true

Size: 311 Bytes

Versions: 13

Compression:

Stored size: 311 Bytes

Contents

require 'optparse'
parser = OptionParser.new
parser.on(
  '--xxx',
  'Option with no argument',
  ->(value) {p ['Handler proc for -xxx called with value:', value]}
)
parser.on(
  '--yyy YYY',
  'Option with required argument',
  ->(value) {p ['Handler proc for -yyy called with value:', value]}
)
parser.parse!

Version data entries

13 entries across 13 versions & 3 rubygems

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