Class: Homebrew::Cmd::Env Private

Inherits:
AbstractCommand show all
Defined in:
cmd/--env.rb,
sorbet/rbi/dsl/homebrew/cmd/env.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Class Method Details

.command_nameString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



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

def self.command_name = "--env"

Instance Method Details

#argsHomebrew::Cmd::Env::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/env.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

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!
  T.cast(ENV, Superenv).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