aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-07-18 03:22:00 -0500
committerJack Nagel2012-08-07 15:32:00 -0500
commit1d295ff3bc214e931646d1bddd477bfc89f20b73 (patch)
tree7e710387eaa306a492afddec60230f59cc9c4872 /Library
parent4f809d0311ab6ca8da897d2a9830b9ecbf262d60 (diff)
downloadbrew-1d295ff3bc214e931646d1bddd477bfc89f20b73.tar.bz2
Automatically append shell completion caveats
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_installer.rb16
-rw-r--r--Library/Homebrew/keg.rb9
2 files changed, 25 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index a2768f7a1..bd341c365 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -158,6 +158,22 @@ class FormulaInstaller
check_infopages
check_m4
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
def finish
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 269999bc3..dae91ea1d 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -58,6 +58,15 @@ class Keg < Pathname
linked_keg_record.directory? and self == linked_keg_record.realpath
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
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?