class WeeklyCommits::CLI
Public Instance Methods
weekly_commits()
click to toggle source
# File lib/weekly_commits/cli.rb, line 35 def weekly_commits relative_week = options[:week] beg_week = relative_week.week.ago.beginning_of_week 5.times do |day_count| date = beg_week + day_count.days week_title = date.strftime('%a, %e %b %Y') git_date_format = date.strftime('%Y-%m-%d') committer = options[:show_author] ? ' (%cn)'.magenta : '' git_log_command = "git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s#{committer}'" git_log_command += ' --no-merges' if options[:no_merge] commits = `#{git_log_command}` commits = commits.lines.reverse if options[:sort].casecmp('asc').zero? puts week_title.yellow puts commits puts end end