Class: GitHop::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/githop/command.rb

Class Method Summary collapse

Class Method Details

.run(other_user, date = 1.year.ago) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/githop/command.rb', line 5

def self.run(other_user, date = 1.year.ago)
  config = YAML.load(File.read("#{ENV['HOME']}/.githop.yml"))
  result = GitHop.hop(config, other_user, date)
  result = GitHop.pretty_print(result, other_user) unless result['rows'].nil?

  if result.is_a?(Array) && result.count > 0
    puts result
  else
    puts "No events found, but #{other_user || 'you'} surely had an awesome day nevertheless :)"
  end
end