Class: RubyHelm::Commands::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_helm/commands/template.rb

Instance Attribute Summary

Attributes inherited from Base

#binary

Instance Method Summary collapse

Methods inherited from Base

#do_after, #do_before, #execute, #initialize, #instantiate_builder, #stderr, #stdin, #stdout

Constructor Details

This class inherits a constructor from RubyHelm::Commands::Base

Instance Method Details

#configure_command(builder, opts) ⇒ Object

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ruby_helm/commands/template.rb', line 11

def configure_command(builder, opts)
  chart = opts[:chart]
  name = opts[:name]
  output_directory = opts[:output_directory]
  values = opts[:values] || {}

  paired_values = values.map do |key, value|
    "#{key}=#{value}"
  end

  builder.with_subcommand('template') do |sub|
    unless values.empty?
      sub = sub.with_option(
        '--set',
        paired_values.join(','),
        separator: ' '
      )
    end
    sub = sub.with_option('--name', name, separator: ' ') if name
    if output_directory
      sub = sub.with_option(
        '--output-dir',
        output_directory,
        separator: ' '
      )
    end
    sub
  end
         .with_argument(chart)
end