Add support for fish shell completions
* Library/Homebrew/caveats.rb: add caveats comparable to other shells * Library/Homebrew/formula.rb: define completion directory along the conventions explained in the fish documentation for $fish_complete_path * Library/Homebrew/keg.rb: add fish shell to check function for installed completions Closes Homebrew/homebrew#39828. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
517ced731c
commit
de43ac7503
@ -12,6 +12,7 @@ class Caveats
|
|||||||
caveats << f.keg_only_text if f.keg_only? && f.respond_to?(:keg_only_text)
|
caveats << f.keg_only_text if f.keg_only? && f.respond_to?(:keg_only_text)
|
||||||
caveats << bash_completion_caveats
|
caveats << bash_completion_caveats
|
||||||
caveats << zsh_completion_caveats
|
caveats << zsh_completion_caveats
|
||||||
|
caveats << fish_completion_caveats
|
||||||
caveats << plist_caveats
|
caveats << plist_caveats
|
||||||
caveats << python_caveats
|
caveats << python_caveats
|
||||||
caveats << app_caveats
|
caveats << app_caveats
|
||||||
@ -46,6 +47,14 @@ class Caveats
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def fish_completion_caveats
|
||||||
|
if keg and keg.completion_installed? :fish and which("fish") then <<-EOS.undent
|
||||||
|
fish completion has been installed to:
|
||||||
|
#{HOMEBREW_PREFIX}/share/fish/vendor_completions.d
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def python_caveats
|
def python_caveats
|
||||||
return unless keg
|
return unless keg
|
||||||
return unless keg.python_site_packages_installed?
|
return unless keg.python_site_packages_installed?
|
||||||
|
|||||||
@ -414,13 +414,19 @@ class Formula
|
|||||||
# installed.
|
# installed.
|
||||||
# This is symlinked into `HOMEBREW_PREFIX` after installation or with
|
# This is symlinked into `HOMEBREW_PREFIX` after installation or with
|
||||||
# `brew link` for formulae that are not keg-only.
|
# `brew link` for formulae that are not keg-only.
|
||||||
def bash_completion; prefix+'etc/bash_completion.d' end
|
def bash_completion; prefix+'etc/bash_completion.d' end
|
||||||
|
|
||||||
# The directory where the formula's ZSH completion files should be
|
# The directory where the formula's ZSH completion files should be
|
||||||
# installed.
|
# installed.
|
||||||
# This is symlinked into `HOMEBREW_PREFIX` after installation or with
|
# This is symlinked into `HOMEBREW_PREFIX` after installation or with
|
||||||
# `brew link` for formulae that are not keg-only.
|
# `brew link` for formulae that are not keg-only.
|
||||||
def zsh_completion; share+'zsh/site-functions' end
|
def zsh_completion; share+'zsh/site-functions' end
|
||||||
|
|
||||||
|
# The directory where the formula's fish completion 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_completion; share+'fish/vendor_completions.d' end
|
||||||
|
|
||||||
# The directory used for as the prefix for {#etc} and {#var} files on
|
# The directory used for as the prefix for {#etc} and {#var} files on
|
||||||
# installation so, despite not being in `HOMEBREW_CELLAR`, they are installed
|
# installation so, despite not being in `HOMEBREW_CELLAR`, they are installed
|
||||||
|
|||||||
@ -222,6 +222,7 @@ class Keg
|
|||||||
dir = case shell
|
dir = case shell
|
||||||
when :bash then path.join("etc", "bash_completion.d")
|
when :bash then path.join("etc", "bash_completion.d")
|
||||||
when :zsh then path.join("share", "zsh", "site-functions")
|
when :zsh then path.join("share", "zsh", "site-functions")
|
||||||
|
when :fish then path.join("share", "fish", "vendor_completions.d")
|
||||||
end
|
end
|
||||||
dir && dir.directory? && dir.children.any?
|
dir && dir.directory? && dir.children.any?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user