def parse_options(argv = ARGV)
argv = argv.dup
opt_parser.parse!(argv)
options.each do |opt_key, opt_value|
if opt_value[:required] && !config.has_key?(opt_key)
reqarg = opt_value[:short] || opt_value[:long]
puts "You must supply #{reqarg}!"
puts @opt_parser
exit 2
end
if opt_value[:in]
unless opt_value[:in].kind_of?(Array)
raise(ArgumentError, "Options config key :in must receive an Array")
end
if !opt_value[:in].include?(config[opt_key])
reqarg = opt_value[:short] || opt_value[:long]
puts "#{reqarg}: #{config[opt_key]} is not included in the list ['#{opt_value[:in].join("', '")}'] "
puts @opt_parser
exit 2
end
end
end
@cli_arguments = argv
argv
end