diff --git a/README.md b/README.md index 442f38f9a..c566e169a 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ It browses the repository and outputs html page with statistics. f, [--from=FROM] # Commit from where statistics should start. t, [--to=TO] # Commit where statistics should stop. # Default: HEAD + s, [--silent] # Silent mode. Don't output anything. #### Start generator with default settings diff --git a/lib/git_stats/cli.rb b/lib/git_stats/cli.rb index 7a0941516..19998cd67 100644 --- a/lib/git_stats/cli.rb +++ b/lib/git_stats/cli.rb @@ -8,12 +8,17 @@ class GitStats::CLI < Thor 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}" } + if options[:silent] + g.add_command_observer { |command, result| } + else + g.add_command_observer { |command, result| puts "#{command}" } + end }.render_all end