mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #19959 from botantony/uninstall-etc
uninstall: exclude configurational filess that belong to other formulae
This commit is contained in:
commit
3f450e5f10
@ -67,7 +67,18 @@ module Homebrew
|
||||
end
|
||||
|
||||
unversioned_name = f.name.gsub(/@.+$/, "")
|
||||
maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*")
|
||||
maybe_paths = Dir.glob("#{f.etc}/#{unversioned_name}*")
|
||||
excluded_names = Homebrew::API::Formula.all_formulae.keys
|
||||
maybe_paths = maybe_paths.reject do |path|
|
||||
# Remove extension only if a file
|
||||
# (f.e. directory with name "openssl@1.1" will be trimmed to "openssl@1")
|
||||
basename = if File.directory?(path)
|
||||
File.basename(path)
|
||||
else
|
||||
File.basename(path, ".*")
|
||||
end
|
||||
excluded_names.include?(basename)
|
||||
end
|
||||
maybe_paths -= paths if paths.present?
|
||||
if maybe_paths.present?
|
||||
puts
|
||||
|
Loading…
x
Reference in New Issue
Block a user