Sha256: 9e5feb85327f9511a51cc92cd968adb8aee7a33392ccfb94593274b12efbbb2a

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'thor'

module GitTrend
  class CLI < Thor
    include GitTrend::Rendering

    map '-v'              => :version,
        '--version'       => :version

    default_command :list

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

    desc :list, "\033[32m(DEFAULT COMMAND)\e[0m List Trending repository on github [-l, -s, -d]"
    option :language,    aliases: '-l', required: false
    option :since,       aliases: '-s', required: false
    option :description, aliases: '-d', required: false
    def list
      scraper = Scraper.new
      projects = scraper.get(options[:language], options[:since])
      render(projects, !!options[:description])
    rescue => e
      say "An unexpected #{e.class} has occurred.", :red
      say e.message
    end

    desc :all_languages, 'Show selectable languages'
    def all_languages
      scraper = Scraper.new
      languages = scraper.list_all_languages
      render_all_languages(languages)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-trend-0.0.8 lib/git_trend/cli.rb
git-trend-0.0.7 lib/git_trend/cli.rb