Hi,

I wanted to take cmd line inputs of the form

File.rb -p A
File.rb -p B STRING
File.rb -p C STRING

Im using optionparser to parse the arguments.

I can create an arg and force it to accept inputs of A/B/C but how do i
ensure the extra arg is accepted only when its B/C?

opts.on("-p [STRING]", [:A,:B,:C], "") do |v|
  options[:p] = v
end

-- 
Posted via http://www.ruby-forum.com/.