aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2009-09-10 14:29:41 +0100
committerMax Howell2009-09-10 19:23:03 +0100
commit535086de273f6a6aa62c072890344ab02e98315e (patch)
treec50fa63bd3ad28d9416c889cf1b18483fde0f839
parentfcd62ce1eb8ac4ed775515f7e877946a62508d65 (diff)
downloadhomebrew-535086de273f6a6aa62c072890344ab02e98315e.tar.bz2
Only allow --interactive with one formula argument
See comments in commit for details.
-rw-r--r--Library/Homebrew/ARGV+yeast.rb3
-rw-r--r--Library/Homebrew/brew.h.rb2
-rwxr-xr-xbin/brew9
3 files changed, 13 insertions, 1 deletions
diff --git a/Library/Homebrew/ARGV+yeast.rb b/Library/Homebrew/ARGV+yeast.rb
index e602d7901..007de9f4c 100644
--- a/Library/Homebrew/ARGV+yeast.rb
+++ b/Library/Homebrew/ARGV+yeast.rb
@@ -66,6 +66,9 @@ module HomebrewArgvExtension
def quieter?
flag? '--quieter'
end
+ def interactive?
+ flag? '--interactive'
+ end
def flag? flag
options.each do |arg|
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index de5048cc3..875f61be0 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -174,7 +174,7 @@ end
def install f
f.brew do
- if ARGV.flag? '--interactive'
+ if ARGV.interactive?
ohai "Entering interactive mode"
puts "Type `exit' to return and finalize the installation"
puts "Install to this prefix: #{f.prefix}"
diff --git a/bin/brew b/bin/brew
index b09c957b8..bf3a449c2 100755
--- a/bin/brew
+++ b/bin/brew
@@ -90,6 +90,15 @@ begin
puts "#{f}: #{ENV[f]}" unless ENV[f].to_s.empty?
end
end
+
+ if ARGV.interactive? and ARGV.formulae.count > 1
+ # the reason for this is interactive mode is a little tricky to do
+ # with more than one formula, AND I can't think of a time where you'd
+ # want to do it anyway. If someone comes up with a legitimate use for
+ # this we will adapt the code. "But I might want it!" is not a
+ # legitimate use!
+ raise "Interactive mode can only be used with one formula argument"
+ end
unless ARGV.force?
unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?