Class: Trendious::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/trendious/application.rb

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



5
6
7
8
# File 'lib/trendious/application.rb', line 5

def initialize
  @client = Trendious::Client.new
  @options = {}
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/trendious/application.rb', line 10

def run
  OptionParser.new do |opts|
    opts.banner = "Usage: trendious [options]"
    opts.on("-q", "--query [String]", String, "Search by name") {|o| @options[:query] = o }
    opts.on("-R", "--read [Integer]", Integer, "Read entry with index") {|o| @options[:read] = o }
    opts.on("-p", "--page [Integer]", Integer, "Select N page") {|o| @options[:page] = o }
    opts.on("-T", "--tags", "Show tags") {|o| @options[:tags] = o }
    opts.on("-t", "--trending [Integer]", Integer, "Select trending by index") {|o| @options[:trending] = o}
    opts.on("-v", "--version", "Display current Trendious version") {|o| @options[:version] = o }
  end.parse!

  puts output
end