Set the exit status correctly
parent
538ee1ec36
commit
55724eb777
|
@ -208,13 +208,11 @@ module FilePullRequestCollector
|
||||||
begin
|
begin
|
||||||
opts.parse!(args)
|
opts.parse!(args)
|
||||||
rescue OptionParser::InvalidOption
|
rescue OptionParser::InvalidOption
|
||||||
puts "Invalid option, try -h for usage"
|
abort "Invalid option, try -h for usage"
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.empty?
|
if options.empty?
|
||||||
puts "No options specified, try -h for usage"
|
abort "No options specified, try -h for usage"
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
options
|
options
|
||||||
|
@ -227,16 +225,15 @@ if __FILE__ == $PROGRAM_NAME
|
||||||
begin
|
begin
|
||||||
opts = FilePullRequestCollector::OptsParser.parse(ARGV)
|
opts = FilePullRequestCollector::OptsParser.parse(ARGV)
|
||||||
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
||||||
puts "#{e.message} (please see -h)"
|
abort "#{e.message} (please see -h)"
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if !opts.has_key?(:api_key)
|
if !opts.has_key?(:api_key)
|
||||||
if !ENV.has_key?('GITHUB_OAUTH_TOKEN')
|
if !ENV.has_key?('GITHUB_OAUTH_TOKEN')
|
||||||
puts
|
abort <<EOF
|
||||||
puts "A Github Access Token must be specified to use this tool"
|
A Github Access Token must be specified to use this tool
|
||||||
puts "Please set GITHUB_OAUTH_TOKEN or specify the -k option"
|
Please set GITHUB_OAUTH_TOKEN or specify the -k option
|
||||||
exit
|
EOF
|
||||||
else
|
else
|
||||||
opts[:api_key] = ENV['GITHUB_OAUTH_TOKEN']
|
opts[:api_key] = ENV['GITHUB_OAUTH_TOKEN']
|
||||||
end
|
end
|
||||||
|
@ -246,8 +243,7 @@ if __FILE__ == $PROGRAM_NAME
|
||||||
cli = FilePullRequestCollector::Client.new(opts[:api_key])
|
cli = FilePullRequestCollector::Client.new(opts[:api_key])
|
||||||
cli.search(opts[:file])
|
cli.search(opts[:file])
|
||||||
rescue FilePullRequestCollector::Exception => e
|
rescue FilePullRequestCollector::Exception => e
|
||||||
$stderr.puts e.message
|
abort e.message
|
||||||
exit
|
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
$stdout.puts
|
$stdout.puts
|
||||||
$stdout.puts "Good bye"
|
$stdout.puts "Good bye"
|
||||||
|
|
Loading…
Reference in New Issue