mirror of
https://github.com/tomgi/git_stats.git
synced 2024-12-22 13:32:17 +01:00
CLI locale setting
This commit is contained in:
parent
26d2df4e0a
commit
89c27a666e
3 changed files with 21 additions and 11 deletions
|
@ -1,2 +1,10 @@
|
|||
en:
|
||||
project_name: Project name
|
||||
project_name: Project name
|
||||
project_version: Project version
|
||||
generated_at: Generated at
|
||||
generator: Generator
|
||||
report_period: Report period
|
||||
total_files: Total files
|
||||
total_lines: Total lines
|
||||
total_commits: Total commits
|
||||
authors: Authors
|
|
@ -3,9 +3,11 @@ require "git_stats"
|
|||
class GitStats::CLI
|
||||
|
||||
def start(*args)
|
||||
raise "Wrong number of arguments\nUsage: git_stats repo_path output_path" unless args.size == 2
|
||||
raise "Wrong number of arguments\nUsage: git_stats repo_path output_path <output_lang>" unless [2, 3].include? args.size
|
||||
|
||||
repo_path, out_path, lang = args
|
||||
I18n.locale = lang || :en
|
||||
|
||||
repo_path, out_path = args
|
||||
GitStats::Generator.new(repo_path, out_path) { |g|
|
||||
g.add_command_observer { |command, result| puts "#{command}" }
|
||||
}.render_all
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
%td= :project_name.t
|
||||
%td= repo.project_name
|
||||
%tr
|
||||
%td Project version
|
||||
%td= :project_version.t
|
||||
%td= repo.project_version
|
||||
%tr
|
||||
%td Generated at
|
||||
%td= :generated_at.t
|
||||
%td= DateTime.now.to_formatted_s(:long)
|
||||
%tr
|
||||
%td Generator
|
||||
%td= :generator.t
|
||||
%td= "GitStats #{GitStats::VERSION}"
|
||||
%tr
|
||||
%td Report period
|
||||
%td= :report_period.t
|
||||
%td= repo.commits_period.map {|d| d.to_formatted_s(:long)}.join(" .. ")
|
||||
%tr
|
||||
%td Total files
|
||||
%td= :total_files.t
|
||||
%td= repo.files_count
|
||||
%tr
|
||||
%td Total lines
|
||||
%td= :total_lines.t
|
||||
%td= "#{repo.lines_count} lines (#{repo.short_stats.map(&:insertions).sum} insertions, #{repo.short_stats.map(&:deletions).sum} deletions)"
|
||||
%tr
|
||||
%td Total commits
|
||||
%td= :total_commits.t
|
||||
%td= repo.commits.size
|
||||
%tr
|
||||
%td Authors
|
||||
%td= :authors.t
|
||||
%td= repo.authors.size
|
||||
|
|
Loading…
Reference in a new issue