Class: AsciidoctorVaped::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv, out: $stdout, err: $stderr) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
11
# File 'lib/asciidoctor_vaped/cli.rb', line 7

def initialize(argv, out: $stdout, err: $stderr)
  @argv = argv.dup
  @out = out
  @err = err
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
# File 'lib/asciidoctor_vaped/cli.rb', line 13

def run
  return string_mode if @argv.first == "-s"
  return usage(1) if @argv.empty?

  file_mode
rescue Errno::ENOENT => error
  @err.puts error.message
  1
end