Advertisement
Guest User

Untitled

a guest
Apr 29th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.34 KB | None | 0 0
  1. require 'trollop'
  2.  
  3. ARGV = ['-n', 'name', '-a', '100']
  4. # ARGV = ['--help']
  5.  
  6. opts = Trollop::options do
  7.     opt :name, 'Your Name', :short => 'n', :type => String, :required => true
  8.     opt :age, 'Your Age', :short => 'a', :type => Integer, :required => true
  9. end
  10.  
  11. p opts
  12.  
  13. puts "Your name is #{opts[:name]}"
  14. puts "Your age is #{opts[:age]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement