blob: 864e33b277aed3e314dc5296fe27acc0576b57e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# Unlinks any Applications (.app) found in installed prefixes from /Applications
require 'keg'
module Homebrew
def unlinkapps
target_dir = ARGV.include?("--local") ? File.expand_path("~/Applications") : "/Applications"
unless File.exist? target_dir
opoo "#{target_dir} does not exist, stopping."
puts "Run `mkdir #{target_dir}` first."
exit 1
end
cellar_apps = Dir[target_dir + '/*.app'].select do |app|
if File.symlink?(app) && File.readlink(app).match(HOMEBREW_CELLAR)
File.readlink app
end
end
cellar_apps.each do |app|
puts "Unlinking #{app}"
system "unlink", app
end
puts "Finished unlinking from #{target_dir}" if cellar_apps
end
end
|