Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'trollop'
- ARGV = ['-n', 'name', '-a', '100']
- # ARGV = ['--help']
- opts = Trollop::options do
- opt :name, 'Your Name', :short => 'n', :type => String, :required => true
- opt :age, 'Your Age', :short => 'a', :type => Integer, :required => true
- end
- p opts
- puts "Your name is #{opts[:name]}"
- puts "Your age is #{opts[:age]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement