aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-12-31 17:03:29 +0000
committerMike McQuaid2016-12-31 17:03:29 +0000
commit82f441396422b44c5f293e2b6597163de2349733 (patch)
tree51ca9eeeb630923b965c406045872fae667ec835 /Library
parent760a4601aa07e993c0ccb9ef01257da7361016e1 (diff)
downloadbrew-82f441396422b44c5f293e2b6597163de2349733.tar.bz2
formula, ARGV: don't output duplicate formulae.
If you specify a formula more than once or it exists in the Cellar with an alias name and the main name (e.g. `qt` and `qt5`) you can see the same formula showing up more than once. Instead, resolve these output lists of formulae such that they are unique based on their `name`. This doesn't use `full_name` as it's `name` that's use for the `Cellar`.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ARGV.rb4
-rw-r--r--Library/Homebrew/formula.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index d361a99a8..767ddc6e3 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -44,7 +44,7 @@ module HomebrewArgvExtension
else
Formulary.find_with_priority(name, spec)
end
- end
+ end.uniq(&:name)
end
def resolved_formulae
@@ -79,7 +79,7 @@ module HomebrewArgvExtension
f.follow_installed_alias = false
f
- end
+ end.uniq(&:name)
end
def casks
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bc1dbd970..02d4b09a0 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1406,7 +1406,7 @@ class Formula
Formulary.from_rack(rack)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
end
- end.compact
+ end.compact.uniq(&:name)
end
def self.installed_with_alias_path(alias_path)