[Bash-completion-devel] using external helpers for completion

Guillaume Rousse Guillaume.Rousse at inria.fr
Wed Aug 25 20:58:39 UTC 2010


Le 25/08/2010 22:08, Freddy Vulto a écrit :
> On 100722 23:39, Guillaume Rousse wrote:
>> A friend of mine just suggested me to have a look at
>> http://github.com/ap/perldoc-complete
>>
>> Basically, it uses an external perl script instead of embedding ugly
>> one-liners in shell script. I tried it, the improvement is impressing.
>>
>> I'd like to import it in the project, but we have no specific provision
>> for using external helpers now, and we still install completions scripts
>> in $sysconfdir/bash_completion.d. I'm going to install it in
>> $datadir/bash_completion/helpers, unless someone has a better suggestion.
> 
> +1 for using helpers.  However, my test suite is failing on perldoc now:
> 
>     FAIL: perldoc - should show completions at timeout
>     FAIL: perldoc should complete word containing colons
> 
> When trying to complete manually I get this:
> 
>     $ perldoc <TAB>bash: @helpersdir@/perldoc: No such file or directory
>     $ complete -p perldoc
>     complete -o default -o nospace -C @helpersdir@/perldoc perldoc
> 
> It looks like when running bash-completion directly from git, the
> `@helpersdir@' isn't replaced properly: how should I get this to work?
You to run 'make' first, to create perldoc file from perldoc.in. Or to
use a custom file creation path, but running the standard autotools
sequence ('autoreconf && configure && make test') would ensure this part
of the project also works.

> Anyway I'd rather see we use a construction like
> `$BASH_COMPLETION_DIR/../helpers' so that bash-completion stays working
> directly from git?
That's a good idea, that would avoid install-time substitution. However,
$BASH_COMPLETION_DIR point to the directory where completions are
sourced, whereas many of us (fedora and mandriva maintainers) only put
symlinks there, and use a distinct directory for installing the whole
set of available completions.

So, I'd rather use a distinct BASH_COMPLETION_DIR_HELPER for this, and
provide it a default value (/usr/share/bash-completion/helper) in main
bash_completion file.

> I think even better - because contrib & helpers having such a strong
> relationship - would be to embed the `helpers' dir within the `contrib'
> dir:
> 
>     +-- contrib
>         +-- helpers
> 
> so that `contrib/perldoc' can do:
> 
>     complete -C ${BASH_SOURCE[0]%/*}/helpers/perldoc perldoc
Installation setup doesn't mandatorily match archive setup.
-- 
BOFH excuse #308:

CD-ROM server needs recalibration

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4251 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20100825/a70ea2d6/attachment.bin>


More information about the Bash-completion-devel mailing list