Class: GitTrend::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


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

def exit_on_failure?
  true
end

Instance Method Details

#languagesObject



44
45
46
47
48
49
# File 'lib/git_trend/cli.rb', line 44

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

#listObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/git_trend/cli.rb', line 29

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



18
19
20
# File 'lib/git_trend/cli.rb', line 18

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