aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-12-08 08:55:00 +0000
committerGitHub2016-12-08 08:55:00 +0000
commit276d00938cd6ea47fc07af27b96755651bb85626 (patch)
tree75897a3fbcad22d805670a4000fc81fdef3756bd
parentba14f87825b969294176e846fae96b7fab9e5b91 (diff)
parent1995f653086ec0b4ab56618105c5678331949106 (diff)
downloadbrew-276d00938cd6ea47fc07af27b96755651bb85626.tar.bz2
Merge pull request #1615 from zachwhaley/fish_functions
Add a method for installing fish function files
-rw-r--r--Library/Homebrew/caveats.rb12
-rw-r--r--Library/Homebrew/formula.rb8
-rw-r--r--Library/Homebrew/keg.rb5
3 files changed, 25 insertions, 0 deletions
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb
index a5568cb29..0b1c0fd23 100644
--- a/Library/Homebrew/caveats.rb
+++ b/Library/Homebrew/caveats.rb
@@ -19,6 +19,7 @@ class Caveats
caveats << bash_completion_caveats
caveats << zsh_completion_caveats
caveats << fish_completion_caveats
+ caveats << fish_function_caveats
caveats << plist_caveats
caveats << python_caveats
caveats << app_caveats
@@ -99,6 +100,17 @@ class Caveats
EOS
end
+ def fish_function_caveats
+ return unless keg
+ return unless keg.fish_functions_installed?
+ return unless which("fish")
+
+ <<-EOS.undent
+ fish functions have been installed to:
+ #{HOMEBREW_PREFIX}/share/fish/vendor_functions.d
+ EOS
+ end
+
def python_caveats
return unless keg
return unless keg.python_site_packages_installed?
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index bae2e3314..3f2653e4a 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -778,6 +778,14 @@ class Formula
HOMEBREW_PREFIX+"var"
end
+ # The directory where the formula's fish function files should be
+ # installed.
+ # This is symlinked into `HOMEBREW_PREFIX` after installation or with
+ # `brew link` for formulae that are not keg-only.
+ def fish_function
+ share+"fish/vendor_functions.d"
+ end
+
# The directory where the formula's Bash completion files should be
# installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index f1275e748..b3d88ea63 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -303,6 +303,11 @@ class Keg
dir && dir.directory? && !dir.children.empty?
end
+ def fish_functions_installed?
+ dir = path.join("share", "fish", "vendor_functions.d")
+ dir && dir.directory? && !dir.children.empty?
+ end
+
def plist_installed?
!Dir["#{path}/*.plist"].empty?
end