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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Wed Dec 29 10:26:33 2004 UTC (9 years, 10 months ago) by ka0ttic
Branch: MAIN
Changes since 1.5: +10 -6 lines
Added variable BASH_COMPLETION_NAME instead of assuming $PN ; defaults to $PN - bug #75798

1 # Copyright 1999-2004 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.5 2004/11/07 01:42:54 ka0ttic Exp $
4 #
5 # Simple eclass that provides an interface for installing
6 # contributed (ie not included in bash-completion proper)
7 # bash-completion scripts.
8 #
9 # Author: Aaron Walker <ka0ttic@gentoo.org>
10 #
11 # Please assign any bug reports to shell-tools@gentoo.org.
12
13 ECLASS="bash-completion"
14 INHERITED="${INHERITED} ${ECLASS}"
15 EXPORT_FUNCTIONS pkg_postinst
16
17 IUSE="${IUSE} bash-completion"
18
19 #RDEPEND="${RDEPEND}
20 # bash-completion? ( app-shells/bash-completion-config )"
21
22 ##### VARIABLES #####
23 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${PN}"
24
25 # dobashcompletion <file> <new file>
26 # First arg, <file>, is required and is the location of the bash-completion
27 # script to install. Second arg, <new file>, is optional and specifies an
28 # alternate filename to install as.
29
30 dobashcompletion() {
31 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
32 [[ -n "$2" ]] && export BASH_COMPLETION_NAME="$2"
33 if useq bash-completion ; then
34 insinto /usr/share/bash-completion
35 newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
36 fi
37 }
38
39 bash-completion_pkg_postinst() {
40 if useq bash-completion ; then
41 echo
42 einfo "To enable command-line completion for ${PN}, run:"
43
44 # NOTE: this is temporary; bash-completion-config will be in RDEPEND
45 # once it goes stable and can be used as a dependency.
46 if has_version 'app-shells/bash-completion-config' ; then
47 einfo
48 einfo " bash-completion-config --install ${BASH_COMPLETION_NAME}"
49 einfo
50 einfo "to install locally, or"
51 einfo
52 einfo " bash-completion-config --global --install ${BASH_COMPLETION_NAME}"
53 einfo
54 einfo "to install system-wide."
55 einfo "Read bash-completion-config(1) for more information."
56 else
57 einfo " ln -s /usr/share/bash-completion/${BASH_COMPLETION_NAME} \\ "
58 einfo " /etc/bash_completion.d/"
59 fi
60 echo
61 fi
62 }

  ViewVC Help
Powered by ViewVC 1.1.20