Class: Thot::CLI

Inherits:
Carioca::Container
  • Object
show all
Defined in:
lib/thot/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(options:, template_file: nil) ⇒ CLI

Returns a new instance of CLI.



9
10
11
12
13
14
15
16
17
18
# File 'lib/thot/cli.rb', line 9

def initialize(options: , template_file: nil )

  @options = options
  output.level = (@options[:debug])? :debug : :info
  output.debug "Debugging mode activated" if @options[:debug]
  @template_file = template_file
  output.info "Assuming Environment : #{@options[:environment]}" if @options[:verbose]
  getting_data
  getting_content
end

Instance Method Details

#generateObject



21
22
23
24
25
26
# File 'lib/thot/cli.rb', line 21

def generate
  template =  Template::new(list_token: @data.keys, template_content: @content, strict: false)
  template.map @data
  output.info "Generating output" if @options[:verbose]
  puts template.output
end