16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/krane/cli/render_command.rb', line 16
def self.from_options(options)
require 'krane/render_task'
require 'krane/bindings_parser'
require 'krane/options_helper'
bindings_parser = ::Krane::BindingsParser.new
options[:bindings]&.each { |b| bindings_parser.add(b) }
filenames = options[:filenames].dup
filenames << "-" if options[:stdin]
if filenames.empty?
raise(Thor::RequiredArgumentMissingError, '--filenames must be set and not empty')
end
::Krane::OptionsHelper.with_processed_template_paths(filenames, render_erb: true) do |paths|
renderer = ::Krane::RenderTask.new(
current_sha: options['current-sha'],
filenames: paths,
bindings: bindings_parser.parse,
)
renderer.run!(stream: STDOUT)
end
end
|