Class: Lf::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ CLI

Returns a new instance of CLI.



6
7
8
9
10
11
12
13
14
15
# File 'lib/lf/cli.rb', line 6

def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
  @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel

  @option = Lf::Option.parse(@argv, @stdin, @stdout)
  @stream = Lf::Stream.new(@option.input, @option.output, @option)

rescue => e
  @stderr.puts e.message
  @kernel.exit(1)
end

Instance Method Details

#execute!Object



17
18
19
20
21
# File 'lib/lf/cli.rb', line 17

def execute!
  @stream.process

  @kernel.exit(0)
end