If multiple kegs, default to formula keg
If it exists, ARGV.kegs will return the Formula.prefix keg for each rack examined. So for ARGV=[wget, foo] and the following Cellar (wget/1.11, wget/1.12, foo/1.0) you'll get [wget/1.12, foo/1.0] from ARGV.kegs provided 1.12 is the formula version of wget.
This commit is contained in:
parent
67c3f1b2b4
commit
735b6337a1
@ -31,8 +31,16 @@ module HomebrewArgvExtension
|
||||
linked_keg_ref = HOMEBREW_REPOSITORY/"Library/LinkedKegs"/name
|
||||
|
||||
if not linked_keg_ref.symlink?
|
||||
raise MultipleVersionsInstalledError.new(name) if dirs.length > 1
|
||||
Keg.new(dirs.first)
|
||||
if dirs.length == 1
|
||||
Keg.new(dirs.first)
|
||||
else
|
||||
prefix = Formula.factory(canonical_name).prefix
|
||||
if prefix.directory?
|
||||
Keg.new(prefix)
|
||||
else
|
||||
raise MultipleVersionsInstalledError.new(name)
|
||||
end
|
||||
end
|
||||
else
|
||||
Keg.new(linked_keg_ref.realpath)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user