lib/git_trend/cli.rb in git-trend-0.0.2 vs lib/git_trend/cli.rb in git-trend-0.0.3
- old
+ new
@@ -1,31 +1,30 @@
require 'thor'
module GitTrend
class CLI < Thor
map '-v' => :version,
- '--version' => :version,
- '-l' => :show,
- '--list' => :show,
- '--all-languages' => :all_languages
+ '--version' => :version
- default_command :show
+ default_command :list
desc :version, 'show version'
def version
say "git-trend version: #{VERSION}", :green
end
- desc :show, 'show Trending repository on github'
- def show(language=nil)
+ desc :list, '[List] Trending repository on github'
+ option :list, aliases:'-l', required: false
+ option :since, aliases:'-s', required: false
+ def list
scraper = Scraper.new
- scraper.get(language)
+ scraper.get(options[:list], options[:since])
rescue => e
say "An unexpected #{e.class} has occurred.", :red
say e.message
end
- desc :all_languages, 'show selectable languages'
+ desc :all_languages, 'Show selectable languages'
def all_languages
scraper = Scraper.new
scraper.list_all_languages
end
end