Sha256: 8656576a6fe25ff7579753b93f842f2261f803e0ee7e9e783c7862c28b6001c6

Contents?: true

Size: 554 Bytes

Versions: 53

Compression:

Stored size: 554 Bytes

Contents

require 'main'

ARGV.replace %w( --foo=40 -f2 ) if ARGV.empty?

Main {
  option('foo', 'f'){
    required  # by default options are not required, we could use 'foo=foo'
              # above as a shortcut
    argument_required
    arity 2
    cast :float
  }

  option('bar=[bar]', 'b'){  # note shortcut syntax for optional args
    # argument_optional      # we could also use this method
    cast :bool
    default false
  }

  def run
    p params['foo'].given?
    p params['foo'].values
    p params['bar'].given?
    p params['bar'].value
  end
}

Version data entries

53 entries across 52 versions & 3 rubygems

Version Path
main-6.3.0 samples/d.rb
main-6.2.3 samples/d.rb
main-6.2.2 samples/d.rb
main-6.2.1 samples/d.rb
main-6.2.0 samples/d.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/d.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/d.rb
main-6.1.0 samples/d.rb
ahoward-main-2.9.0 samples/d.rb
main-6.0.0 samples/d.rb
main-5.3.2 samples/d.rb
main-5.3.1 samples/d.rb
main-5.2.0 samples/d.rb
main-5.1.1 samples/d.rb
main-5.1.0 samples/d.rb
main-5.0.1 samples/d.rb
main-5.0.0 samples/d.rb
main-4.8.1 samples/d.rb
main-4.8.0 samples/d.rb
main-4.7.7 samples/d.rb