utils: add link_path_manpages method.
This commit is contained in:
parent
e93771ae07
commit
8cc027a3cd
@ -594,3 +594,26 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
|||||||
out.encode!("UTF-8")
|
out.encode!("UTF-8")
|
||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_path_manpages(path, command)
|
||||||
|
return unless (path/"man").exist?
|
||||||
|
conflicts = []
|
||||||
|
(path/"man").find do |src|
|
||||||
|
next if src.directory?
|
||||||
|
dst = HOMEBREW_PREFIX/"share"/src.relative_path_from(path)
|
||||||
|
next if dst.symlink? && src == dst.resolved_path
|
||||||
|
if dst.exist?
|
||||||
|
conflicts << dst
|
||||||
|
next
|
||||||
|
end
|
||||||
|
dst.make_relative_symlink(src)
|
||||||
|
end
|
||||||
|
unless conflicts.empty?
|
||||||
|
onoe <<-EOS.undent
|
||||||
|
Could not link #{name} manpages to:
|
||||||
|
#{conflicts.join("\n")}
|
||||||
|
|
||||||
|
Please delete these files and run `#{command}`.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user