9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/issue_exporter/cli.rb', line 9
def run
begin
OptionParser.new do |opts|
define_options opts
opts.on "-h", "--help" do
puts usage
exit
end
opts.on "--version" do
puts about
exit
end
end.parse!
rescue OptionParser::ParseError => e
raise UsageError, e
end
fail UsageError, "missing argument" if ARGV.empty?
fail UsageError, "incorrect number of arguments" unless correct_number_of_args ARGV.count
ARGV.each_with_index { |arg, index| process_input arg, index }
perform_action()
rescue UsageError => e
puts "#{$PROGRAM_NAME}: #{e}\nTry `#{$PROGRAM_NAME} --help` for more information."
exit false
end
|