Class: Homebrew::Cmd::Env

Inherits:
AbstractCommand show all
Defined in:
cmd/--env.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Class Method Details

.command_nameString

Returns:



13
# File 'cmd/--env.rb', line 13

def self.command_name = "--env"

Instance Method Details

#runvoid

This method returns an undefined value.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'cmd/--env.rb', line 32

def run
  ENV.activate_extensions!
  ENV.deps = args.named.to_formulae if superenv?(nil)
  ENV.setup_build_environment

  shell = if args.plain?
    nil
  elsif args.shell.nil?
    :bash unless $stdout.tty?
  elsif args.shell == "auto"
    Utils::Shell.parent || Utils::Shell.preferred
  elsif args.shell
    Utils::Shell.from_path(T.must(args.shell))
  end

  if shell.nil?
    BuildEnvironment.dump ENV.to_h
  else
    BuildEnvironment.keys(ENV.to_h).each do |key|
      puts Utils::Shell.export_value(key, ENV.fetch(key), shell)
    end
  end
end