/[gentoo-x86]/eclass/bash-completion.eclass
Gentoo

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.24 - (hide annotations) (download)
Wed Apr 7 04:20:46 2010 UTC (4 years, 3 months ago) by darkside
Branch: MAIN
Changes since 1.23: +8 -8 lines
Due to portage's environment filtering, variables that start with BASH_ cannot be used. As such, s/BASH_COMPLETION_NAME/BASHCOMPLETION_NAME/g for bug 312671

1 ulm 1.23 # Copyright 1999-2010 Gentoo Foundation
2 ka0ttic 1.1 # Distributed under the terms of the GNU General Public License v2
3 darkside 1.24 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.23 2010/01/02 00:07:46 ulm Exp $
4 pva 1.17
5     # @ECLASS: bash-completion.eclass
6     # @MAINTAINER:
7     # shell-tools@gentoo.org.
8 ka0ttic 1.1 #
9 pva 1.17 # Original author: Aaron Walker <ka0ttic@gentoo.org>
10     # @BLURB: An Interface for installing contributed bash-completion scripts
11     # @DESCRIPTION:
12 ka0ttic 1.1 # Simple eclass that provides an interface for installing
13     # contributed (ie not included in bash-completion proper)
14     # bash-completion scripts.
15 pva 1.17
16 darkside 1.24 # @ECLASS-VARIABLE: BASHCOMPLETION_NAME
17 pva 1.17 # @DESCRIPTION:
18     # Install the completion script with this name (see also dobashcompletion)
19 ka0ttic 1.1
20 ka0ttic 1.5 EXPORT_FUNCTIONS pkg_postinst
21 ka0ttic 1.1
22 swegener 1.15 IUSE="bash-completion"
23 ka0ttic 1.3
24 ulm 1.22 # Allow eclass to be inherited by eselect without a circular dependency
25     if [[ ${CATEGORY}/${PN} != app-admin/eselect ]]; then
26     RDEPEND="bash-completion? ( app-admin/eselect )"
27     fi
28 ulm 1.23 PDEPEND="bash-completion? ( app-shells/bash-completion )"
29 ka0ttic 1.1
30 pva 1.17 # @FUNCTION: dobashcompletion
31     # @USAGE: < file > [ new_file ]
32     # @DESCRIPTION:
33     # First arg, <file>, is required and is the location of the bash-completion
34 darkside 1.24 # script to install. If the variable BASHCOMPLETION_NAME is set in the
35 ka0ttic 1.9 # ebuild, dobashcompletion will install <file> as
36 darkside 1.24 # /usr/share/bash-completion/$BASHCOMPLETION_NAME. If it is not set,
37 pva 1.17 # dobashcompletion will check if a second arg [new_file] was passed, installing as
38 ka0ttic 1.9 # the specified name. Failing both these checks, dobashcompletion will
39     # install the file as /usr/share/bash-completion/${PN}.
40 ka0ttic 1.1 dobashcompletion() {
41 ka0ttic 1.6 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
42 darkside 1.24 [[ -z "${BASHCOMPLETION_NAME}" ]] && BASHCOMPLETION_NAME="${2:-${PN}}"
43 ka0ttic 1.7
44 ulm 1.23 if use bash-completion ; then
45 ka0ttic 1.1 insinto /usr/share/bash-completion
46 darkside 1.24 newins "$1" "${BASHCOMPLETION_NAME}" || die "Failed to install $1"
47 ka0ttic 1.1 fi
48     }
49 ka0ttic 1.5
50 pva 1.17 # @FUNCTION: bash-completion_pkg_postinst
51     # @DESCRIPTION:
52     # The bash-completion pkg_postinst function, which is exported
53 ka0ttic 1.5 bash-completion_pkg_postinst() {
54 ulm 1.23 if use bash-completion ; then
55 ulm 1.22 elog "In the case that you haven't yet enabled command-line completion"
56     elog "for ${PN}, you can run:"
57 darkside 1.19 elog
58 darkside 1.24 elog " eselect bashcomp enable ${BASHCOMPLETION_NAME:-${PN}}"
59 darkside 1.19 elog
60     elog "to install locally, or"
61     elog
62 darkside 1.24 elog " eselect bashcomp enable --global ${BASHCOMPLETION_NAME:-${PN}}"
63 darkside 1.19 elog
64     elog "to install system-wide."
65 ka0ttic 1.5 fi
66     }

  ViewVC Help
Powered by ViewVC 1.1.20