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

Contents of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (hide annotations) (download)
Thu Sep 8 19:06:46 2011 UTC (3 years ago) by mgorny
Branch: MAIN
Changes since 1.27: +13 -1 lines
Deprecate in favor of -r1.

1 vapier 1.27 # Copyright 1999-2011 Gentoo Foundation
2 ka0ttic 1.1 # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.28 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.27 2011/08/22 04:46:31 vapier Exp $
4    
5     # @DEPRECATED
6     # This eclass has been superseded by bash-completion-r1 eclass.
7     # Please modify your ebuilds to use that one instead.
8 pva 1.17
9     # @ECLASS: bash-completion.eclass
10     # @MAINTAINER:
11     # shell-tools@gentoo.org.
12 vapier 1.27 # @AUTHOR:
13 pva 1.17 # Original author: Aaron Walker <ka0ttic@gentoo.org>
14     # @BLURB: An Interface for installing contributed bash-completion scripts
15     # @DESCRIPTION:
16 ka0ttic 1.1 # Simple eclass that provides an interface for installing
17     # contributed (ie not included in bash-completion proper)
18     # bash-completion scripts.
19 mgorny 1.28 #
20     # Note: this eclass has been deprecated in favor of bash-completion-r1. Please
21     # use that one instead.
22 pva 1.17
23 darkside 1.24 # @ECLASS-VARIABLE: BASHCOMPLETION_NAME
24 pva 1.17 # @DESCRIPTION:
25     # Install the completion script with this name (see also dobashcompletion)
26 ka0ttic 1.1
27 dirtyepic 1.25 # @ECLASS-VARIABLE: BASHCOMPFILES
28     # @DESCRIPTION:
29     # Space delimited list of files to install if dobashcompletion is called without
30     # arguments.
31    
32 mgorny 1.28 inherit eutils
33    
34 ka0ttic 1.5 EXPORT_FUNCTIONS pkg_postinst
35 ka0ttic 1.1
36 swegener 1.15 IUSE="bash-completion"
37 ka0ttic 1.3
38 ulm 1.22 # Allow eclass to be inherited by eselect without a circular dependency
39     if [[ ${CATEGORY}/${PN} != app-admin/eselect ]]; then
40     RDEPEND="bash-completion? ( app-admin/eselect )"
41     fi
42 ulm 1.23 PDEPEND="bash-completion? ( app-shells/bash-completion )"
43 ka0ttic 1.1
44 pva 1.17 # @FUNCTION: dobashcompletion
45 dirtyepic 1.25 # @USAGE: [file] [new_file]
46 pva 1.17 # @DESCRIPTION:
47 dirtyepic 1.25 # The first argument is the location of the bash-completion script to install,
48     # and is required if BASHCOMPFILES is not set. The second argument is the name
49     # the script will be installed as. If BASHCOMPLETION_NAME is set, it overrides
50     # the second argument. If no second argument is given and BASHCOMPLETION_NAME
51     # is not set, it will default to ${PN}.
52 ka0ttic 1.1 dobashcompletion() {
53 dirtyepic 1.25 local f
54    
55 mgorny 1.28 eqawarn "bash-completion.eclass has been deprecated."
56     eqawarn "Please update your ebuilds to use bash-completion-r1 instead."
57    
58 dirtyepic 1.25 if [[ -z ${1} && -z ${BASHCOMPFILES} ]]; then
59     die "Usage: dobashcompletion [file] [new file]"
60     fi
61 ka0ttic 1.7
62 dirtyepic 1.25 if use bash-completion; then
63 ka0ttic 1.1 insinto /usr/share/bash-completion
64 dirtyepic 1.25 if [[ -n ${1} ]]; then
65     [[ -z ${BASHCOMPLETION_NAME} ]] && BASHCOMPLETION_NAME="${2:-${PN}}"
66     newins "${1}" "${BASHCOMPLETION_NAME}" || die "Failed to install ${1}"
67     else
68     set -- ${BASHCOMPFILES}
69     for f in "$@"; do
70     if [[ -e ${f} ]]; then
71     doins "${f}" || die "Failed to install ${f}"
72     fi
73     done
74     fi
75 ka0ttic 1.1 fi
76     }
77 ka0ttic 1.5
78 pva 1.17 # @FUNCTION: bash-completion_pkg_postinst
79     # @DESCRIPTION:
80     # The bash-completion pkg_postinst function, which is exported
81 ka0ttic 1.5 bash-completion_pkg_postinst() {
82 dirtyepic 1.25 local f
83    
84 ulm 1.23 if use bash-completion ; then
85 dirtyepic 1.25 elog "The following bash-completion scripts have been installed:"
86     if [[ -n ${BASHCOMPLETION_NAME} ]]; then
87     elog " ${BASHCOMPLETION_NAME}"
88     else
89     set -- ${BASHCOMPFILES}
90     for f in "$@"; do
91     elog " $(basename ${f})"
92     done
93     fi
94 darkside 1.19 elog
95 dirtyepic 1.25 elog "To enable command-line completion on a per-user basis run:"
96     elog " eselect bashcomp enable <script>"
97 darkside 1.19 elog
98 dirtyepic 1.25 elog "To enable command-line completion system-wide run:"
99     elog " eselect bashcomp enable --global <script>"
100 ka0ttic 1.5 fi
101     }

  ViewVC Help
Powered by ViewVC 1.1.20