Method: Nugrant::Helper::Env::Exporter.terminal_exporter

Defined in:
lib/nugrant/helper/env/exporter.rb

.terminal_exporter(bag, options = {}) ⇒ side-effect

Export to terminal the commands that are required to export or unset a bunch of environment variables taken from the bag.

Options:

* :escape_value => If true, escape the value to export (or unset), default to true.
* :io => The io where the command should be displayed, default to $stdout.
* :namer => The namer used to transform bag segments into variable name, default to Namer::default().
* :override => If true, variable a exported even when the override an existing env key, default to true.
* :type => The type of command, default to :export.

Parameters:

  • bag

    The bag to create the script for.

Returns:

  • (side-effect)

    Outputs to io the commands generated.

[View source]

99
100
101
102
103
104
105
106
# File 'lib/nugrant/helper/env/exporter.rb', line 99

def self.terminal_exporter(bag, options = {})
  io = options[:io] || $stdout
  type = options[:type] || :export

  export(bag, options) do |key, value|
    io.puts(command(type, key, value, options))
  end
end