lib/gistory/cli/main.rb in gistory-0.1.8 vs lib/gistory/cli/main.rb in gistory-0.2.0

- old
+ new

@@ -32,17 +32,35 @@ @io.puts "Gem: #{gem_name}" @io.puts "Current version: #{changes.first.version}" @io.puts '' + print_change_history(changes) + + @io.puts '' + + print_configuration_info + end + + def print_change_history(changes) @io.puts 'Change history:' + max_length = changes.map { |c| c.version.length }.max + changes.each do |change| - @io.puts "#{change.version} on #{change.date.strftime('%a, %e %b %Y %H:%M %Z')} (commit #{change.short_hash})" + @io.puts "#{change.version.ljust(max_length)} on #{change.date.strftime('%a, %e %b %Y %H:%M %Z')} " \ + "(commit #{change.short_hash})" end + end - @io.puts '' - max = Gistory.config.max_lockfile_changes - @io.puts "The last #{max} changes to the lock file were taken into account, to see farther in the past use the -m switch" # rubocop:disable Metrics/LineLength + def print_configuration_info + max = Gistory.config.max_fetched_commits + if Gistory.config.all_branches? + @io.puts "The last #{max} changes to the lock file were fetched." + else + @io.puts "The last #{max} commits made to the current branch were fetched." + end + + @io.puts 'To see farther in the past use the -m switch' end end end end