Module: Lslinks::Cli

Defined in:
lib/lslinks/cli.rb

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/lslinks/cli.rb', line 3

def run(argv)
  options, resource_name = *Lslinks::OptionParser.(argv)
  Lslinks::Reader.open(resource_name, **options) do |resource_stream|
    Lslinks::Parser.each_link(resource_stream, **options) do |link|
      Lslinks::Formatter.output(resource_name, link, **options)
    end
  end
rescue => e
  raise if Lslinks.debug?

  $stderr.puts(e.message)
end