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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Thu Jul 17 09:38:08 2008 UTC (6 years, 1 month ago) by pva
Branch: MAIN
Changes since 1.16: +21 -10 lines
Make eclass ready for eclass-manpages, bug #210645, thank mren for all work.

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
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 # bash-completion-config is deprecated in favor of eselect,
25 # however, eselect currently lacks stable keywords.
26 RDEPEND="bash-completion?
27 ( || (
28 app-admin/eselect
29 app-shells/bash-completion-config
30 )
31 )"
32
33 # @FUNCTION: dobashcompletion
34 # @USAGE: < file > [ new_file ]
35 # @DESCRIPTION:
36 # First arg, <file>, is required and is the location of the bash-completion
37 # script to install. If the variable BASH_COMPLETION_NAME is set in the
38 # ebuild, dobashcompletion will install <file> as
39 # /usr/share/bash-completion/$BASH_COMPLETION_NAME. If it is not set,
40 # dobashcompletion will check if a second arg [new_file] was passed, installing as
41 # the specified name. Failing both these checks, dobashcompletion will
42 # install the file as /usr/share/bash-completion/${PN}.
43 dobashcompletion() {
44 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>"
45 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
46
47 if useq bash-completion ; then
48 insinto /usr/share/bash-completion
49 newins "$1" "${BASH_COMPLETION_NAME}" || die "Failed to install $1"
50 fi
51 }
52
53 # @FUNCTION: bash-completion_pkg_postinst
54 # @DESCRIPTION:
55 # The bash-completion pkg_postinst function, which is exported
56 bash-completion_pkg_postinst() {
57 if useq bash-completion ; then
58 echo
59 einfo "To enable command-line completion for ${PN}, run:"
60 einfo
61 if has_version app-admin/eselect ; then
62 einfo " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
63 else
64 einfo " bash-completion-config --install ${BASH_COMPLETION_NAME:-${PN}}"
65 einfo
66 einfo "to install locally, or"
67 einfo
68 einfo " bash-completion-config --global --install ${BASH_COMPLETION_NAME:-${PN}}"
69 einfo
70 einfo "to install system-wide."
71 einfo "Read bash-completion-config(1) for more information."
72 fi
73 echo
74 fi
75 }

  ViewVC Help
Powered by ViewVC 1.1.20