Module: Dieses::Application::CLI::Single

Defined in:
lib/dieses/application/cli/single.rb

Class Method Summary collapse

Class Method Details

.call(*argv, **options) ⇒ Object



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

def self.call(*argv, **options)
  options = OpenStruct.new(options)
  args options(argv, options), argv

  sheet = argv.first

  return puts(out = Application.produce(sheet, **options.to_h)) unless options[:output]

  File.write(options[:output], out)
rescue OptionParser::InvalidOption, Dieses::Error => e
  abort(e.message)
end