/[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.13 Revision 1.29
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.13 2005/07/06 20:20:03 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion.eclass,v 1.29 2013/07/05 17:39:10 ulm 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.
12 22
13INHERITED="${INHERITED} ${ECLASS}" 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
33
14EXPORT_FUNCTIONS pkg_postinst 34EXPORT_FUNCTIONS pkg_postinst
15 35
16IUSE="${IUSE} bash-completion" 36IUSE="bash-completion"
17 37
18RDEPEND="${RDEPEND} 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
19 bash-completion? ( app-shells/bash-completion-config )" 42PDEPEND="bash-completion? ( app-shells/bash-completion )"
20 43
21# dobashcompletion <file> <new file> 44# @FUNCTION: dobashcompletion
22# First arg, <file>, is required and is the location of the bash-completion 45# @USAGE: [file] [new_file]
23# script to install. If the variable BASH_COMPLETION_NAME is set in the 46# @DESCRIPTION:
24# ebuild, dobashcompletion will install <file> as 47# The first argument is the location of the bash-completion script to install,
25# /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
26# 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
27# the specified name. Failing both these checks, dobashcompletion will 50# the second argument. If no second argument is given and BASHCOMPLETION_NAME
28# install the file as /usr/share/bash-completion/${PN}. 51# is not set, it will default to ${PN}.
52dobashcompletion() {
53 local f
29 54
30dobashcompletion() { 55 eqawarn "bash-completion.eclass has been deprecated."
31 [[ -z "$1" ]] && die "usage: dobashcompletion <file> <new file>" 56 eqawarn "Please update your ebuilds to use bash-completion-r1 instead."
32 [[ -z "${BASH_COMPLETION_NAME}" ]] && BASH_COMPLETION_NAME="${2:-${PN}}"
33 57
58 if [[ -z ${1} && -z ${BASHCOMPFILES} ]]; then
59 die "Usage: dobashcompletion [file] [new file]"
60 fi
61
34 if useq bash-completion ; then 62 if use bash-completion; then
35 insinto /usr/share/bash-completion 63 insinto /usr/share/bash-completion
64 if [[ -n ${1} ]]; then
65 [[ -z ${BASHCOMPLETION_NAME} ]] && BASHCOMPLETION_NAME="${2:-${PN}}"
36 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
37 fi 75 fi
38} 76}
39 77
78# @FUNCTION: bash-completion_pkg_postinst
79# @DESCRIPTION:
80# The bash-completion pkg_postinst function, which is exported
40bash-completion_pkg_postinst() { 81bash-completion_pkg_postinst() {
82 local f
83
41 if useq bash-completion ; then 84 if use bash-completion ; then
42 echo 85 elog "The following bash-completion scripts have been installed:"
43 einfo "To enable command-line completion for ${PN}, run:" 86 if [[ -n ${BASHCOMPLETION_NAME} ]]; then
44 einfo 87 elog " ${BASHCOMPLETION_NAME}"
45 if has_version app-admin/eselect ; then
46 einfo " eselect bashcomp enable ${BASH_COMPLETION_NAME:-${PN}}"
47 else 88 else
48 einfo " bash-completion-config --install ${BASH_COMPLETION_NAME:-${PN}}" 89 set -- ${BASHCOMPFILES}
49 einfo 90 for f in "$@"; do
50 einfo "to install locally, or" 91 elog " $(basename ${f})"
51 einfo 92 done
52 einfo " bash-completion-config --global --install ${BASH_COMPLETION_NAME:-${PN}}"
53 einfo
54 einfo "to install system-wide."
55 einfo "Read bash-completion-config(1) for more information."
56 fi 93 fi
57 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>"
58 fi 100 fi
59} 101}

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.20