diff options
| author | Mike McQuaid | 2016-12-12 13:27:40 +0000 |
|---|---|---|
| committer | GitHub | 2016-12-12 13:27:40 +0000 |
| commit | c317c3c31f7e502dfc9c97f8e1b19a89f7d794b3 (patch) | |
| tree | 128a19df1243dbfce51f62f1a4d3c1546c116560 /Library/Homebrew | |
| parent | ebe45490b61decfd53574df615ab3d9e775c938e (diff) | |
| parent | 14f46625a3e734a6b0e1ecdd8f146da20de5ea96 (diff) | |
| download | brew-c317c3c31f7e502dfc9c97f8e1b19a89f7d794b3.tar.bz2 | |
Merge pull request #1616 from zachwhaley/zsh_functions_caveats
caveats: Differentiate zsh completion files and function files
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/caveats.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/keg.rb | 11 |
3 files changed, 29 insertions, 1 deletions
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 0b1c0fd23..3dfdb1c87 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 << zsh_function_caveats caveats << fish_function_caveats caveats << plist_caveats caveats << python_caveats @@ -100,6 +101,16 @@ class Caveats EOS end + def zsh_function_caveats + return unless keg + return unless keg.zsh_functions_installed? + + <<-EOS.undent + zsh functions have been installed to: + #{HOMEBREW_PREFIX}/share/zsh/site-functions + EOS + end + def fish_function_caveats return unless keg return unless keg.fish_functions_installed? diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 64631a789..c80cd517f 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -800,6 +800,14 @@ class Formula HOMEBREW_PREFIX+"var" end + # The directory where the formula's ZSH 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 zsh_function + share+"zsh/site-functions" + end + # The directory where the formula's fish function 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 0dfad1a42..1de4ce1f0 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -297,12 +297,21 @@ class Keg def completion_installed?(shell) dir = case shell when :bash then path.join("etc", "bash_completion.d") - when :zsh then path.join("share", "zsh", "site-functions") + when :zsh + dir = path.join("share", "zsh", "site-functions") + dir if dir && dir.directory? && dir.children.any? { |f| f.basename.to_s.start_with?("_") } when :fish then path.join("share", "fish", "vendor_completions.d") end dir && dir.directory? && !dir.children.empty? end + def zsh_functions_installed? + # Check for non completion functions (i.e. files not started with an underscore), + # since those can be checked separately + dir = path.join("share", "zsh", "site-functions") + dir && dir.directory? && dir.children.any? { |f| !f.basename.to_s.start_with?("_") } + end + def fish_functions_installed? dir = path.join("share", "fish", "vendor_functions.d") dir && dir.directory? && !dir.children.empty? |
