I'm trying to take the argument values using OptionParser. Instead of values, my code is returning only boolean:
require 'optparse'
options ={}
opts = OptionParser.new do |opts|
opts.on('-v') { |version| options[:version] = version }
opts.on('-g') { |branch| options[:branch] = branch }
opts.on('-f') { |full| options[:full] = full }
opts.on('-h') { RDoc::usage }
end.parse!
# mandatory options
if (options[:version] == nil) or (options[:branch] == nil) or (options[:full]== nil) then
puts options[:branch]
puts options[:version]
puts options[:full]
RDoc::usage('usage')
end
puts options[:branch]
---> TRUE
Any idea?