#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/inline'
require 'optparse'

gemfile do
  source 'https://rubygems.org'

  gem 'gitlab_quality-test_tooling', '~> 3'
end

require_relative '../lib/tooling/diff_stats_exporter'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"

  opts.on('--debug', 'Enable debug logging') do
    options[:debug] = true
  end

  opts.on('-h', '--help', 'Show this help message') do
    puts opts
    exit
  end
end.parse!

log_level = options[:debug] ? :debug : :info
success = Tooling::DiffStatsExporter.new(log_level: log_level).execute

success ? exit(0) : exit(1)
