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

Diff of /eclass/bash-completion.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20