[Bash-completion-devel] Mandriva handling of bash completion

David Paleino d.paleino at gmail.com
Sat Jan 17 18:12:30 UTC 2009


On Sat, 17 Jan 2009 13:28:22 +0100, Guillaume Rousse wrote:

> Guillaume Rousse a écrit :
> > See for instance various code currently not part of upstream
> > bash-completion package:
> > 
> > [..]
> 
> I didn't had much input of those completions sofar. As Ville seems to 
> prefer post-commit review, I will introduce them one by one in contrib 
> directory. I just asked for project membership.

Please, commit them into to_review/.
We don't really want to release/install unreviewed completions :-) (because
ones installed into contrib/ would automatically get installed
into /etc/bash_completion.d/ / /usr/share/bash-completion/contrib/ right now)

(it could also be useful to update the wiki with completions needing review,
I'm going to make a dedicated page for it)

> Just a question, tough, as everyone seems to be OK for moving to a 
> installation-based system for activating completion functions, should we 
> really keep the have("foo") { } condition in each file ?

IMHO yes. It ensures loading the function only when the command is really
available.

> In such a scenarion, if a completion file get sourced, it his because it has
> been enabled, meaning the command is available.

Not really. Actually, if you don't use have foo && {}, the function gets
loaded, even if you don't have the command.
Also, we haven't really settled on the new directory layout, so I'd prefer to
just keep things "the old way" for now.

> I have no real clue about the exact cost calling this function, but avoiding
> useless tests at each new shell startup seems a good idea for me.

Well, executing have() doesn't seem to much expensive ;-)

~ $ have() {
> unset -v have
> PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null && have="yes"
> }
~ $ time have ssh

real	0m0.000s
user	0m0.000s
sys	0m0.000s
~ $ echo $have 
yes
~ $

Sure, it is just one command, and not the whole bunch of completions, but I
don't really think some seconds fractions really hurt.

Also, but this is something we should work on at a later time IMHO, there's
also the bash-completion-lib fork, which seems to "dinamically" load
completions when the command is typed. But that's just food for thought.

Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20090117/190c4fed/attachment.pgp 


More information about the Bash-completion-devel mailing list