class Worklog::CLI

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/git/worklog.rb, line 51
def self.exit_on_failure?
  true
end

Public Instance Methods

show() click to toggle source
# File lib/git/worklog.rb, line 65
def show
  commits = {}
  git_command = "git --no-pager log --exclude=refs/stash --pretty=oneline --date=short --since=#{options[:days] || 7}.days --author=\"#{user(options[:user])}\" --all"
  repos.each do |repo|
    repo_name = repo.split("/").last
    output = `cd #{repo} && #{git_command}`
    commits[repo_name] = output
    system("cd #{pwd}")
  end
  commits = commits.filter { |key, value| value != ""}
  commits.map do |key, value|
    if key == "."
      puts "\n\n---------------- PROJECT: #{root_repository_name} -----------------\n\n"
    else
      puts "\n\n---------------- PROJECT: #{key} -----------------\n\n"
    end
    puts value
  end
end