Sha256: be33f045b1d6a401504cb408f5edb4d35f788698aafe6c71192ecf2e04ce1a05

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# -*- encoding : utf-8 -*-
require "git_stats"
require "thor"

class GitStats::CLI < Thor
  option :path, :aliases => :p, :default => '.', :desc => 'Path to repository from which statistics should be generated.'
  option :output, :aliases => :o, :default => './git_stats', :desc => 'Output path where statistics should be written.'
  option :language, :aliases => :l, :default => 'en', :desc => 'Language of written statistics.'
  option :from, :aliases => :f, :desc => 'Commit from where statistics should start.'
  option :to, :aliases => :t, :default => 'HEAD', :desc => 'Commit where statistics should stop.'
  option :silent, :aliases => :s, :type => :boolean, :desc => 'Silent mode. Don\'t output anything.'

  desc 'generate', 'Generates the statistics of a repository'
  def generate
    I18n.locale = options[:language]
    GitStats::Generator.new(options[:path], options[:output], options[:from], options[:to]) { |g|
      g.add_command_observer { |command, result| puts "#{command}" } unless options[:silent]
    }.render_all
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_stats-1.0.11 lib/git_stats/cli.rb
git_stats-1.0.10 lib/git_stats/cli.rb