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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (show annotations) (download)
Fri Feb 20 06:45:12 2009 UTC (5 years, 9 months ago) by darkside
Branch: MAIN
Changes since 1.19: +2 -3 lines
opps, removed wrong portion of if/else statement. Thanks to tove for pointing this out

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.19 2009/02/20 06:22:15 darkside Exp $
4
5 # @ECLASS: bash-completion.eclass
6 # @MAINTAINER:
7 # shell-tools@gentoo.org.
8 #
9 # Original author: Aaron Walker <ka0ttic@gentoo.org>
10 # @BLURB: An Interface for installing contributed bash-completion scripts
11 # @DESCRIPTION:
12 # Simple eclass that provides an interface for installing
13 # contributed (ie not included in bash-completion proper)
14 # bash-completion scripts.
15
16 # @ECLASS-VARIABLE: BASH_COMPLETION_NAME
17 # @DESCRIPTION:
18 # Install the completion script with this name (see also dobashcompletion)
19
20 EXPORT_FUNCTIONS pkg_postinst
21
22 IUSE="bash-completion"
23
24 RDEPEND="bash-completion? ( app-admin/eselect )"
25
26 # @FUNCTION: dobashcompletion
27 # @USAGE: < file > [ new_file ]
28 # @DESCRIPTION:
29 # First arg, <file>, is required and is the location of the bash-completion
30 # script to install. If the variable BASH_COMPLETION_NAME is set in the
31 # ebuild, dobashcompletion will install <file> as
32 # /usr/share/bash-completion/$BASH_COMPLETION_NAME. If it is not set,
33 # dobashcompletion will check if a second arg [new_file] was passed, installing as
34 # the specified name. Failing both these checks, dobashcompletion will
35 # install the file as /usr/share/bash-completion/${PN}.
36 dobashcompletion() {
37 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
38 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
39
40 if useq bash-completion ; then
41 insinto /usr/share/bash-completion
42 newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
43 fi
44 }
45
46 # @FUNCTION: bash-completion_pkg_postinst
47 # @DESCRIPTION:
48 # The bash-completion pkg_postinst function, which is exported
49 bash-completion_pkg_postinst() {
50 if useq bash-completion ; then
51 elog "To enable command-line completion for ${PN}, run:"
52 elog
53 elog " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
54 elog
55 elog "to install locally, or"
56 elog
57 elog " eselect bashcomp enable --global ${BASH_COMPLETION_NAME:-${PN}}"
58 elog
59 elog "to install system-wide."
60 elog "Read bash-completion-config(1) for more information."
61 fi
62 }

  ViewVC Help
Powered by ViewVC 1.1.20