Sha256: f7d9cd312193f189385e7d61ee3f4f218e81da5d34c83d4252c7b20580e186c7

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

#!/usr/bin/env ruby

# frozen_string_literal: true

require "how_is"
require "how_is/cli"

begin
  result = HowIs::CLI.parse(ARGV)
rescue HowIs::CLI::OptionsError => e
  raise if ENV["SHOW_TRACE"]

  abort "Error: #{e.message}"
end

options = result[:options]

if options[:help]
  puts result[:opts]
  exit
elsif options[:version]
  puts HowIs::VERSION
  exit
end

begin
  if options[:config]
    reports = HowIs.from_config(YAML.load_file(options[:config]))

    reports.each { |file, report| HowIs::Report.save_report(file, report) }
  else
    report =
      if options[:from]
        json_report = File.open(options[:from]).read
        HowIs.from_json(json_report)
      else
        HowIs.new(options[:repository])
      end

    HowIs::Report.save_report(
      options[:report],
      HowIs::Report.to_format_based_on(options[:report], report)
    )
  end
rescue => e
  raise if ENV["SHOW_TRACE"]

  abort "Error: #{e.message}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
how_is-19.0.0 exe/how_is
how_is-18.1.0 exe/how_is
how_is-18.0.5 exe/how_is