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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations) (download)
Sat Jan 2 00:07:46 2010 UTC (5 years, 5 months ago) by ulm
Branch: MAIN
Changes since 1.22: +5 -4 lines
Add PDEPEND on app-shells/bash-completion, bug 299051.

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 ulm 1.23 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.22 2009/12/31 15:57:04 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     # @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 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 ka0ttic 1.9 # script to install. If the variable BASH_COMPLETION_NAME is set in the
35     # ebuild, dobashcompletion will install <file> as
36     # /usr/share/bash-completion/$BASH_COMPLETION_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 ka0ttic 1.7 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
43    
44 ulm 1.23 if use bash-completion ; then
45 ka0ttic 1.1 insinto /usr/share/bash-completion
46 ka0ttic 1.6 newins "$1" "${BASH_COMPLETION_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     elog " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
59     elog
60     elog "to install locally, or"
61     elog
62 darkside 1.20 elog " eselect bashcomp enable --global ${BASH_COMPLETION_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