diff --git a/Mk/Uses/completions.mk b/Mk/Uses/completions.mk new file mode 100644 --- /dev/null +++ b/Mk/Uses/completions.mk @@ -0,0 +1,36 @@ +# Helper for programmable shell completions. +# +# Feature: completions +# Usage: USES=completions OR USES=completions:ARGS +# Valid ARGS: (none), env +# +# none Create the preliminary shell completion directories +# and expose the port variables. +# env Expose the port variables only. +# +# Variables, which can be used by the port: +# +# BASH_COMPDIR Path to the bash completion directory. +# FISH_COMPDIR Path to the fish completion directory. +# ZSH_COMPDIR Path to the zsh completion directory. +# +# MAINTAINER: ports@FreeBSD.org + +.if !defined(_INCLUDE_USES_COMPLETIONS_MK) +_INCLUDE_USES_COMPLETIONS_MK= yes + +_valid_ARGS= env +. for _arg in ${completions_ARGS} +. if !${_valid_ARGS:M${_arg}} +IGNORE= USES=completions: invalid argument: ${_arg} +. endif +. endfor + +BASH_COMPDIR?= ${PREFIX}/share/bash-completion/completions +FISH_COMPDIR?= ${PREFIX}/share/fish/vendor_completions.d +ZSH_COMPDIR?= ${PREFIX}/share/zsh/site-functions + +. for shell in BASH FISH ZSH +PLIST_SUB+= ${shell}_COMPDIR=${${shell}_COMPDIR:S,^${PREFIX}/,,} +. endfor +.endif