linkapps: output nothing if no apps exist

The standard message can be somewhat confusing (#38695) in that it
outputs “finished linking” language regardless of whether an app is
actually present/linked or not.

This solution just stops it saying anything if there’s no app in the
directory. It needs a little tidying in the output here, but it’s a
discussion point.

Closes Homebrew/homebrew#38728.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Dominyk Tiller 2015-04-17 02:08:55 +01:00 committed by Mike McQuaid
parent adedbb86f1
commit 703de5556f

View File

@ -25,7 +25,7 @@ module Homebrew
kegs.each do |keg|
keg = keg.opt_record if keg.optlinked?
Dir["#{keg}/*.app", "#{keg}/bin/*.app", "#{keg}/libexec/*.app"].each do |app|
puts "Linking #{app}"
puts "Linking #{app} to #{target_dir}."
app_name = File.basename(app)
target = "#{target_dir}/#{app_name}"
@ -33,10 +33,9 @@ module Homebrew
onoe "#{target} already exists, skipping."
next
end
system "ln", "-sf", app, target_dir
end
end
puts "Finished linking. Find the links under #{target_dir}."
end
end