Sha256: 5ced95fc14e21051262043493fc2813c68a4b897309563278aa71e7de5fbdb53

Contents?: true

Size: 379 Bytes

Versions: 53

Compression:

Stored size: 379 Bytes

Contents

require 'main'

ARGV.replace %w( 42 ) if ARGV.empty?

Main {
  argument('foo'){
    required                    # this is the default
    cast :int                   # value cast to Fixnum
    validate{|foo| foo == 42}   # raises error in failure case 
    description 'the foo param' # shown in --help
  }

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

Version data entries

53 entries across 52 versions & 3 rubygems

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