shell: tweak export_value parameters.

Let’s have a default value for shell (considering this isn’t a public
API) to make it easier to use.
This commit is contained in:
Mike McQuaid 2018-07-26 10:48:25 +01:00
parent b74974611c
commit 74c77db5bd
2 changed files with 4 additions and 2 deletions

View File

@ -37,7 +37,9 @@ module Homebrew
if shell.nil? if shell.nil?
dump_build_env ENV dump_build_env ENV
else else
env_keys.each { |key| puts Utils::Shell.export_value(shell, key, ENV[key]) } env_keys.each do |key|
puts Utils::Shell.export_value(key, ENV[key], shell)
end
end end
end end
end end

View File

@ -21,7 +21,7 @@ module Utils
end end
# quote values. quoting keys is overkill # quote values. quoting keys is overkill
def export_value(shell, key, value) def export_value(key, value, shell = preferred)
case shell case shell
when :bash, :ksh, :sh, :zsh when :bash, :ksh, :sh, :zsh
"export #{key}=\"#{sh_quote(value)}\"" "export #{key}=\"#{sh_quote(value)}\""