#!/usr/bin/ruby.ruby2.5 

require File.expand_path('../../lib/changelog_generator', __FILE__)


options = Options.parse(ARGV)
changelog = ChangelogGenerator::Changelog.new(
  options.old_packages,
  options.new_packages)
reporter = ChangelogGenerator::Reporter.new(changelog)

if options.old_changelog
  unless File.exist?(options.old_changelog)
    warn "Cannot open #{ARGV[2]}"
    exit 1
  end
  old_changelog = File.read(options.old_changelog)
end

puts reporter.report(old_changelog)
