Class: Elrio::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(output = $stdout) ⇒ CLI

Returns a new instance of CLI.



3
4
5
# File 'lib/elrio/cli.rb', line 3

def initialize(output = $stdout)
  @output = output
end

Instance Method Details

#run(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/elrio/cli.rb', line 7

def run(args)
  runner = Runner.new
  cmd = args.shift

  return usage unless cmd

  args.each do |path|
    insets = runner.send(cmd, path)
    @output.puts "#{path}: #{insets}"
  end
end