Gentoo Archives: gentoo-dev

From: Alexander Kapshuk <alexander.kapshuk@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] bash-completion-r1: support for aliasing completions for commands
Date: Wed, 27 Aug 2014 16:38:06
Message-Id: CAJ1xhMVKYuW5EZ=pbenXfWPSSzMKiZ+-w_WWaC2wpFZGMF9p6Q@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH] bash-completion-r1: support for aliasing completions for commands by Alexander Kapshuk
1 On Wed, Aug 27, 2014 at 7:32 PM, Alexander Kapshuk
2 <alexander.kapshuk@×××××.com> wrote:
3 > On Wed, Aug 27, 2014 at 7:01 PM, Bertrand Jacquin <beber@××××××××.net> wrote:
4 >> Hi Michał,
5 >>
6 >> On 2014-08-27 17:06, Michał Górny wrote:
7 >>
8 >>> Please review.
9 >>
10 >>
11 >>> +bashcomp_alias() {
12 >>> + debug-print-function ${FUNCNAME} "${@}"
13 >>> +
14 >>> + [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>..."
15 >>> + local base=${1} f
16 >>> + shift
17 >>> +
18 >>> + for f; do
19 >>
20 >>
21 >> is there a missing 'in "$@" after 'for f' ? f is never initialized.
22 >>
23 >>
24 >>> + dosym "${base}"
25 >>> "$(_bash-completion-r1_get_bashcompdir)/${f}"
26 >>> + done
27 >>> +}
28 >>
29 >>
30 >> --
31 >> Beber
32 >>
33 >
34 > bash(1)
35 > for name [ [ in [ word ... ] ] ; ] do list ; done
36 > <snip>
37 > If the in word is omitted, the for command
38 > executes list once for each positional
39 > parameter that is set (see PARAMETERS below).
40
41 Here's a test run:
42 cat test4loop
43 #!/bin/sh
44 for f
45 do echo $f
46 done
47
48 sh -x test4loop 1 2 3
49 + for f in '"$@"'
50 + echo 1
51 1
52 + for f in '"$@"'
53 + echo 2
54 2
55 + for f in '"$@"'
56 + echo 3
57 3