1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 # This eclass has been superseded by bash-completion-r1 eclass.
9 # Please modify your ebuilds to use that one instead.
11 # @ECLASS: bash-completion.eclass
13 # shell-tools@gentoo.org.
15 # Original author: Aaron Walker <ka0ttic@gentoo.org>
16 # @BLURB: An Interface for installing contributed bash-completion scripts
18 # Simple eclass that provides an interface for installing
19 # contributed (ie not included in bash-completion proper)
20 # bash-completion scripts.
22 # Note: this eclass has been deprecated in favor of bash-completion-r1. Please
23 # use that one instead.
25 # @ECLASS-VARIABLE: BASHCOMPLETION_NAME
27 # Install the completion script with this name (see also dobashcompletion)
29 # @ECLASS-VARIABLE: BASHCOMPFILES
31 # Space delimited list of files to install if dobashcompletion is called without
36 eqawarn "bash-completion.eclass is last rited and will be removed on 2015-11-24."
37 eqawarn "Please update your ebuilds to use bash-completion-r1 instead."
39 EXPORT_FUNCTIONS pkg_postinst
41 IUSE="bash-completion"
43 # Allow eclass to be inherited by eselect without a circular dependency
44 if [[ ${CATEGORY}/${PN} != app-admin/eselect ]]; then
45 RDEPEND="bash-completion? ( app-admin/eselect )"
47 PDEPEND="bash-completion? ( app-shells/bash-completion )"
49 # @FUNCTION: dobashcompletion
50 # @USAGE: [file] [new_file]
52 # The first argument is the location of the bash-completion script to install,
53 # and is required if BASHCOMPFILES is not set. The second argument is the name
54 # the script will be installed as. If BASHCOMPLETION_NAME is set, it overrides
55 # the second argument. If no second argument is given and BASHCOMPLETION_NAME
56 # is not set, it will default to ${PN}.
60 eqawarn "bash-completion.eclass has been deprecated."
61 eqawarn "Please update your ebuilds to use bash-completion-r1 instead."
63 if [[ -z ${1} && -z ${BASHCOMPFILES} ]]; then
64 die "Usage: dobashcompletion [file] [new file]"
67 if use bash-completion; then
68 insinto /usr/share/bash-completion
69 if [[ -n ${1} ]]; then
70 [[ -z ${BASHCOMPLETION_NAME} ]] && BASHCOMPLETION_NAME="${2:-${PN}}"
71 newins "${1}" "${BASHCOMPLETION_NAME}" || die "Failed to install ${1}"
73 set -- ${BASHCOMPFILES}
75 if [[ -e ${f} ]]; then
76 doins "${f}" || die "Failed to install ${f}"
83 # @FUNCTION: bash-completion_pkg_postinst
85 # The bash-completion pkg_postinst function, which is exported
86 bash-completion_pkg_postinst() {
89 if use bash-completion ; then
90 elog "The following bash-completion scripts have been installed:"
91 if [[ -n ${BASHCOMPLETION_NAME} ]]; then
92 elog " ${BASHCOMPLETION_NAME}"
94 set -- ${BASHCOMPFILES}
96 elog " $(basename ${f})"
100 elog "To enable command-line completion on a per-user basis run:"
101 elog " eselect bashcomp enable <script>"
103 elog "To enable command-line completion system-wide run:"
104 elog " eselect bashcomp enable --global <script>"