mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Automatically append shell completion caveats
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
4f809d0311
commit
1d295ff3bc
@ -158,6 +158,22 @@ class FormulaInstaller
|
|||||||
check_infopages
|
check_infopages
|
||||||
check_m4
|
check_m4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
keg = Keg.new(f.prefix)
|
||||||
|
|
||||||
|
if keg.completion_installed? :bash
|
||||||
|
ohai 'Caveats', <<-EOS.undent
|
||||||
|
Bash completion has been installed to:
|
||||||
|
#{HOMEBREW_PREFIX}/etc/bash_completion.d
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
if keg.completion_installed? :zsh
|
||||||
|
ohai 'Caveats', <<-EOS.undent
|
||||||
|
zsh completion has been installed to:
|
||||||
|
#{HOMEBREW_PREFIX}/share/zsh/site-functions
|
||||||
|
EOS
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def finish
|
def finish
|
||||||
|
@ -58,6 +58,15 @@ class Keg < Pathname
|
|||||||
linked_keg_record.directory? and self == linked_keg_record.realpath
|
linked_keg_record.directory? and self == linked_keg_record.realpath
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def completion_installed? shell
|
||||||
|
dir = case shell
|
||||||
|
when :bash then self/'etc/bash_completion.d'
|
||||||
|
when :zsh then self/'share/zsh/site-functions'
|
||||||
|
end
|
||||||
|
return if dir.nil?
|
||||||
|
dir.directory? and not dir.children.length.zero?
|
||||||
|
end
|
||||||
|
|
||||||
def link mode=nil
|
def link mode=nil
|
||||||
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
|
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user