Class: Trendhub::Commands::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/trendhub/commands/repo.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Repo

Returns a new instance of Repo.



9
10
11
# File 'lib/trendhub/commands/repo.rb', line 9

def initialize(options)
  @options = options
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/trendhub/commands/repo.rb', line 13

def execute
  repositories = Trendhub::Repositories.new.fetch(options[:for], options[:language])
  repositories.each do |repo|
    $stdout.puts "-" * 100
    $stdout.puts "#{colorizer.decorate(repo.name, :bold)} has #{colorizer.decorate(repo.added_stars, :bold, :red)} stars added #{repo.time_period}"
    $stdout.puts repo.desc
    repo_info = blank?(repo.language) ? "" : "#{repo.language}          "
    repo_info += "★  #{repo.stars}          "
    repo_info += "#{repo.forks} forks"
    $stdout.puts repo_info
    $stdout.puts "URL: #{repo.url}"
  end
end