5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/api_diff/cli.rb', line 5
def parse(arguments)
formats = ["swift-interface", "kotlin-bcv"]
parser = OptionParser.new do |opts|
opts.on("-f", "--format FORMAT", formats, "Possible values are: #{formats.join(",")}")
opts.on("-s", "--short-names", "Use short instead of fully qualified names")
opts.on("-n", "--normalize")
opts.on("-o", "--order ORDER", ["global", "fqn"])
end
options = {}
begin
parser.parse!(arguments, into: options)
rescue OptionParser::ParseError => e
raise Error.new e.message
end
options[:input] = arguments.pop
raise Error.new "Missing argument: format" if options[:format].nil?
raise Error.new "Missing argument: input" if options[:input].nil?
options
end
|