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

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

  ViewVC Help
Powered by ViewVC 1.1.20