summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-09-02 15:28:05 +0000
committerMichał Górny <mgorny@gentoo.org>2014-09-02 15:28:05 +0000
commitf7392ba226e6f6a12fe6fa7a37cafd2731e8bd61 (patch)
tree30c6c99765322861b956fb8ca617b930b6250d14 /eclass
parentVersion bump, drop old (diff)
downloadgentoo-2-f7392ba226e6f6a12fe6fa7a37cafd2731e8bd61.tar.gz
gentoo-2-f7392ba226e6f6a12fe6fa7a37cafd2731e8bd61.tar.bz2
gentoo-2-f7392ba226e6f6a12fe6fa7a37cafd2731e8bd61.zip
Add bashcomp_alias function to create command aliases for completion.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/bash-completion-r1.eclass18
2 files changed, 21 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 3dd6c83ef073..70868e52e879 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1361 2014/08/30 14:06:04 blueness Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1362 2014/09/02 15:28:05 mgorny Exp $
+
+ 02 Sep 2014; Michał Górny <mgorny@gentoo.org> bash-completion-r1.eclass:
+ Add bashcomp_alias function to create command aliases for completion.
30 Aug 2014; Anthony G. Basile <blueness@gentoo.org> pax-utils.eclass:
Update pax-utils.eclass according to bug #520198
diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass
index ba12a1bfaca4..db16e27c1983 100644
--- a/eclass/bash-completion-r1.eclass
+++ b/eclass/bash-completion-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion-r1.eclass,v 1.13 2014/08/27 08:15:27 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion-r1.eclass,v 1.14 2014/09/02 15:28:05 mgorny Exp $
# @ECLASS: bash-completion-r1.eclass
# @MAINTAINER:
@@ -116,3 +116,19 @@ newbashcomp() {
newins "${@}"
)
}
+
+# @FUNCTION: bashcomp_alias
+# @USAGE: <basename> <alias>...
+# @DESCRIPTION:
+# Alias <basename> completion to one or more commands (<alias>es).
+bashcomp_alias() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>..."
+ local base=${1} f
+ shift
+
+ for f; do
+ dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}"
+ done
+}