Class: GitTrend::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/git_trend/cli.rb

Instance Method Summary collapse

Instance Method Details

#languagesObject



38
39
40
41
42
43
# File 'lib/git_trend/cli.rb', line 38

def languages
  scraper = Scraper.new
  languages = scraper.languages
  formatter = Formatter.new(options[:format])
  formatter.print_languages(languages)
end

#listObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/git_trend/cli.rb', line 23

def list
  help(:list) && return if options[:help]
  scraper = Scraper.new
  projects = scraper.get(options[:language], options[:since], options[:number])
  formatter = Formatter.new(options[:format])
  formatter.print(projects, enable_description: !!options[:description])
rescue => e
  say "An unexpected #{e.class} has occurred.", :red
  say e.message unless e.class.to_s == e.message

  puts exception.backtrace if options[:verbose]
end

#versionObject



12
13
14
# File 'lib/git_trend/cli.rb', line 12

def version
  say "git-trend version: #{VERSION}", :green
end