Class: Abscss::CLI

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

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cli.rb', line 6

def self.execute(stdout, arguments=[])

  if ARGV.size < 1
    $stderr.puts "Usage: abscss files_or_urls"
    exit(-1)
  end

  t = Abscss::Traverser.new
  ARGV.each do |arg|
    raw = open(arg).read
    doc = Nokogiri::HTML(raw)
    doc.root.children.each do |child|
      t.traverse(child)
    end
  end
  puts t.output
end