changed cli argument names to match repo properties

This commit is contained in:
Tomasz Gieniusz 2014-06-25 20:07:08 +02:00
parent f035ae16bb
commit 00558355dd
2 changed files with 7 additions and 7 deletions

View File

@ -6,11 +6,11 @@ class GitStats::CLI < Thor
option :path, :aliases => :p, :default => '.', :desc => 'Path to repository from which statistics should be generated.'
option :out_path, :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 :first_commit_sha, :aliases => :f, :desc => 'Commit from where statistics should start.'
option :last_commit_sha, :aliases => :t, :default => 'HEAD', :desc => 'Commit where statistics should stop.'
option :silent, :aliases => :s, :type => :boolean, :desc => 'Silent mode. Don\'t output anything.'
option :tree, :aliases => :d, :default => '.', :desc => 'Tree where statistics should be generated.'
option :comment, :aliases => :c, :default => '//', :desc => 'The string which is used for comments.'
option :comment_string, :aliases => :c, :default => '//', :desc => 'The string which is used for comments.'
desc 'generate', 'Generates the statistics of a repository'
def generate

View File

@ -35,6 +35,10 @@ module GitStats
@comment_string ||= '//'
end
def tree
@tree ||= Tree.new(repo: self, relative_path: @tree_path)
end
def authors
@authors ||= run_and_parse("git shortlog -se #{commit_range} #{tree_path}").map do |author|
Author.new(repo: self, name: author[:name], email: author[:email])
@ -115,10 +119,6 @@ module GitStats
@project_version ||= run("git rev-parse --short #{commit_range}").strip
end
def tree
@tree ||= Tree.new(repo: self, relative_path: @tree_path)
end
def project_name
@project_name ||= (File.expand_path(File.join(path, tree_path)).sub(File.dirname(File.expand_path(path))+File::SEPARATOR,"") || File.basename(path))
end