Sha256: 77de8f64ab8af14ece5da19cf8860a0a8e33f4169c3b11b8975b3c93273e5163

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

require 'thor'

require 'attractor'

module Attractor
  # contains methods implementing the CLI
  class CLI < Thor
    desc 'calc', 'Calculates churn and complexity for all ruby files in current directory'
    option :file_prefix, aliases: :p
    def calc
      puts 'Calculated churn and complexity'
      puts
      puts "file_path#{' ' * 53}complexity   churn"
      puts '-' * 80
      Attractor::Calculator.output_console(file_prefix: options[:file_prefix])
    end

    desc 'report', 'Generates an HTML report'
    option :format, aliases: :f, default: 'html'
    option :file_prefix, aliases: :p
    def report
      puts 'Generating an HTML report'
      Attractor::Calculator.report(format: options[:format], file_prefix: options[:file_prefix])
      puts "Generated HTML report at #{File.expand_path './attractor_output/index.html'}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attractor-0.1.2 lib/attractor/cli.rb