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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (hide annotations) (download)
Thu Dec 31 15:57:04 2009 UTC (4 years, 9 months ago) by ulm
Branch: MAIN
Changes since 1.21: +7 -3 lines
Add a test for app-admin/eselect around RDEPEND to avoid circular dependencies.
Clarify elog message.

1 pva 1.17 # Copyright 1999-2008 Gentoo Foundation
2 ka0ttic 1.1 # Distributed under the terms of the GNU General Public License v2
3 ulm 1.22 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.21 2009/02/21 20:17:01 darkside 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     # @ECLASS-VARIABLE: BASH_COMPLETION_NAME
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 ka0ttic 1.1
29 pva 1.17 # @FUNCTION: dobashcompletion
30     # @USAGE: < file > [ new_file ]
31     # @DESCRIPTION:
32     # First arg, <file>, is required and is the location of the bash-completion
33 ka0ttic 1.9 # script to install. If the variable BASH_COMPLETION_NAME is set in the
34     # ebuild, dobashcompletion will install <file> as
35     # /usr/share/bash-completion/$BASH_COMPLETION_NAME. If it is not set,
36 pva 1.17 # dobashcompletion will check if a second arg [new_file] was passed, installing as
37 ka0ttic 1.9 # the specified name. Failing both these checks, dobashcompletion will
38     # install the file as /usr/share/bash-completion/${PN}.
39 ka0ttic 1.1 dobashcompletion() {
40 ka0ttic 1.6 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
41 ka0ttic 1.7 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
42    
43 ka0ttic 1.1 if useq bash-completion ; then
44     insinto /usr/share/bash-completion
45 ka0ttic 1.6 newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
46 ka0ttic 1.1 fi
47     }
48 ka0ttic 1.5
49 pva 1.17 # @FUNCTION: bash-completion_pkg_postinst
50     # @DESCRIPTION:
51     # The bash-completion pkg_postinst function, which is exported
52 ka0ttic 1.5 bash-completion_pkg_postinst() {
53     if useq bash-completion ; then
54 ulm 1.22 elog "In the case that you haven't yet enabled command-line completion"
55     elog "for ${PN}, you can run:"
56 darkside 1.19 elog
57     elog " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
58     elog
59     elog "to install locally, or"
60     elog
61 darkside 1.20 elog " eselect bashcomp enable --global ${BASH_COMPLETION_NAME:-${PN}}"
62 darkside 1.19 elog
63     elog "to install system-wide."
64 ka0ttic 1.5 fi
65     }

  ViewVC Help
Powered by ViewVC 1.1.20