aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2016-09-04 21:23:33 +0100
committerGitHub2016-09-04 21:23:33 +0100
commitdfcbefff73e90eda5801d9892303e10fc31831b6 (patch)
treee20a7c5a5a28458d7729155c2b537ac63bc0aadd /Library/Homebrew/cmd
parent8e98a0a198551f19696b3c09469fcbb1e1223f73 (diff)
parentdcc3377aa30b34dfcced0df77696674f91a5a9f3 (diff)
downloadbrew-dfcbefff73e90eda5801d9892303e10fc31831b6.tar.bz2
Merge pull request #201 from gregory-nisbet/feature-env-shells
--env: support more shells, allow explicit shell selection
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/--env.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb
index 281175c93..0feb338dc 100644
--- a/Library/Homebrew/cmd/--env.rb
+++ b/Library/Homebrew/cmd/--env.rb
@@ -3,6 +3,7 @@
require "extend/ENV"
require "build_environment"
+require "utils/shell"
module Homebrew
def __env
@@ -11,12 +12,24 @@ module Homebrew
ENV.setup_build_environment
ENV.universal_binary if ARGV.build_universal?
- if $stdout.tty?
+ shell_value = ARGV.value("shell")
+
+ if ARGV.include?("--plain")
+ shell = nil
+ elsif shell_value.nil?
+ # legacy behavior
+ shell = :bash unless $stdout.tty?
+ elsif shell_value == "auto"
+ shell = Utils::Shell.parent_shell || Utils::Shell.preferred_shell
+ elsif shell_value
+ shell = Utils::Shell.path_to_shell(shell_value)
+ end
+
+ env_keys = build_env_keys(ENV)
+ if shell.nil?
dump_build_env ENV
else
- build_env_keys(ENV).each do |key|
- puts "export #{key}=\"#{ENV[key]}\""
- end
+ env_keys.each { |key| puts Utils::Shell.export_value(shell, key, ENV[key]) }
end
end
end