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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Thu Dec 30 00:18:25 2004 UTC (11 years, 7 months ago) by ka0ttic
Branch: MAIN
Changes since 1.6: +3 -5 lines
Remove global BASH_COMPLETION_NAME var

1 ka0ttic 1.1 # Copyright 1999-2004 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 ka0ttic 1.7 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.6 2004/12/29 10:26:33 ka0ttic Exp $
4 ka0ttic 1.1 #
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 ka0ttic 1.5 EXPORT_FUNCTIONS pkg_postinst
16 ka0ttic 1.1
17     IUSE="${IUSE} bash-completion"
18 ka0ttic 1.3
19     #RDEPEND="${RDEPEND}
20 ka0ttic 1.5 # bash-completion? ( app-shells/bash-completion-config )"
21 ka0ttic 1.1
22     # dobashcompletion <file> <new file>
23     # First arg, <file>, is required and is the location of the bash-completion
24     # script to install. Second arg, <new file>, is optional and specifies an
25     # alternate filename to install as.
26    
27     dobashcompletion() {
28 ka0ttic 1.6 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
29 ka0ttic 1.7 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
30    
31 ka0ttic 1.1 if useq bash-completion ; then
32     insinto /usr/share/bash-completion
33 ka0ttic 1.6 newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
34 ka0ttic 1.1 fi
35     }
36 ka0ttic 1.5
37     bash-completion_pkg_postinst() {
38     if useq bash-completion ; then
39     echo
40     einfo "To enable command-line completion for ${PN}, run:"
41    
42     # NOTE: this is temporary; bash-completion-config will be in RDEPEND
43     # once it goes stable and can be used as a dependency.
44     if has_version 'app-shells/bash-completion-config' ; then
45     einfo
46 ka0ttic 1.6 einfo " bash-completion-config --install ${BASH_COMPLETION_NAME}"
47 ka0ttic 1.5 einfo
48     einfo "to install locally, or"
49     einfo
50 ka0ttic 1.6 einfo " bash-completion-config --global --install ${BASH_COMPLETION_NAME}"
51 ka0ttic 1.5 einfo
52     einfo "to install system-wide."
53     einfo "Read bash-completion-config(1) for more information."
54     else
55 ka0ttic 1.6 einfo " ln -s /usr/share/bash-completion/${BASH_COMPLETION_NAME} \\ "
56 ka0ttic 1.5 einfo " /etc/bash_completion.d/"
57     fi
58     echo
59     fi
60     }

  ViewVC Help
Powered by ViewVC 1.1.20