1 |
Hi, |
2 |
|
3 |
One of the requirements of the completion autoloading is that there is |
4 |
a file or symlink in ${completionsdir} for every completed command. For |
5 |
example, if 'bakefile' completion provides completions for both |
6 |
bakefile and bakefile_gen, there should be an extra symlink |
7 |
from bakefile_gen to bakefile. |
8 |
|
9 |
To make it easy to accommodate this requirements for Gentoo-originating |
10 |
completions and to fix issues with upstream completions, I would like |
11 |
to add a new bashcomp_alias() function. |
12 |
|
13 |
It is to be used like: |
14 |
|
15 |
newbashcomp bash_completion bakefile |
16 |
bashcomp_alias bakefile bakefile_gen |
17 |
|
18 |
or: |
19 |
|
20 |
bashcomp_alias emerge ebuild revdep-rebuild metagen ... |
21 |
|
22 |
Please review. |
23 |
|
24 |
diff -u -B -r1.13 bash-completion-r1.eclass |
25 |
--- bash-completion-r1.eclass 27 Aug 2014 08:15:27 -0000 1.13 |
26 |
+++ bash-completion-r1.eclass 27 Aug 2014 14:47:01 -0000 |
27 |
@@ -116,3 +116,19 @@ |
28 |
newins "${@}" |
29 |
) |
30 |
} |
31 |
+ |
32 |
+# @FUNCTION: bashcomp_alias |
33 |
+# @USAGE: <basename> <alias>... |
34 |
+# @DESCRIPTION: |
35 |
+# Alias <basename> completion to one or more commands (<alias>es). |
36 |
+bashcomp_alias() { |
37 |
+ debug-print-function ${FUNCNAME} "${@}" |
38 |
+ |
39 |
+ [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>..." |
40 |
+ local base=${1} f |
41 |
+ shift |
42 |
+ |
43 |
+ for f; do |
44 |
+ dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}" |
45 |
+ done |
46 |
+} |
47 |
|
48 |
-- |
49 |
Best regards, |
50 |
Michał Górny |