Class: Tansaku::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/tansaku/cli.rb', line 30

def exit_on_failure?
  true
end

Instance Method Details

#crawl(url) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/tansaku/cli.rb', line 16

def crawl(url)
  params = options.compact.map { |k, v| [k.to_sym, v] }.to_h
  begin
    crawler = Crawler.new(url, **params)
    results = crawler.crawl
    puts results.to_json
  rescue ArgumentError => e
    puts e
  end
end