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

Contents of /eclass/bash-completion-r1.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Thu Jun 13 16:23:56 2013 UTC (15 months ago) by mgorny
Branch: MAIN
Changes since 1.3: +23 -4 lines
Introduce get_bashcompdir(), wrt bug #469858.

1 mgorny 1.4 # Copyright 1999-2013 Gentoo Foundation
2 mgorny 1.1 # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.4 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion-r1.eclass,v 1.3 2012/09/27 16:35:41 axs Exp $
4 mgorny 1.1
5     # @ECLASS: bash-completion-r1.eclass
6     # @MAINTAINER:
7     # mgorny@gentoo.org
8     # @BLURB: A few quick functions to install bash-completion files
9     # @EXAMPLE:
10     #
11     # @CODE
12     # EAPI=4
13     #
14     # src_install() {
15     # default
16     #
17     # newbashcomp contrib/${PN}.bash-completion ${PN}
18     # }
19     # @CODE
20    
21 mgorny 1.2 case ${EAPI:-0} in
22 axs 1.3 0|1|2|3|4|5) ;;
23 mgorny 1.2 *) die "EAPI ${EAPI} unsupported (yet)."
24     esac
25    
26 mgorny 1.4 # @FUNCTION: _bash-completion-r1_get_bashcompdir
27     # @INTERNAL
28     # @DESCRIPTION:
29     # Get unprefixed bash-completion directory.
30     _bash-completion-r1_get_bashcompdir() {
31     debug-print-function ${FUNCNAME} "${@}"
32    
33     echo /usr/share/bash-completion
34     }
35    
36     # @FUNCTION: get_bashcompdir
37     # @DESCRIPTION:
38     # Get the bash-completion directory.
39     get_bashcompdir() {
40     debug-print-function ${FUNCNAME} "${@}"
41    
42     echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
43     }
44    
45 mgorny 1.1 # @FUNCTION: dobashcomp
46     # @USAGE: file [...]
47     # @DESCRIPTION:
48     # Install bash-completion files passed as args. Has EAPI-dependant failure
49     # behavior (like doins).
50     dobashcomp() {
51     debug-print-function ${FUNCNAME} "${@}"
52    
53     (
54 mgorny 1.4 insinto "$(_bash-completion-r1_get_bashcompdir)"
55 mgorny 1.1 doins "${@}"
56     )
57     }
58    
59     # @FUNCTION: newbashcomp
60     # @USAGE: file newname
61     # @DESCRIPTION:
62     # Install bash-completion file under a new name. Has EAPI-dependant failure
63     # behavior (like newins).
64     newbashcomp() {
65     debug-print-function ${FUNCNAME} "${@}"
66    
67     (
68 mgorny 1.4 insinto "$(_bash-completion-r1_get_bashcompdir)"
69 mgorny 1.1 newins "${@}"
70     )
71     }

  ViewVC Help
Powered by ViewVC 1.1.20