[Bash-completion-devel] Towards dynamic completion loading

Igor Murzov e-mail at date.by
Sat Oct 22 23:08:27 UTC 2011


On Sat, 22 Oct 2011 13:00:57 +0300
Ville Skyttä <ville.skytta at iki.fi> wrote:

> On 10/03/2011 04:03 AM, Igor Murzov wrote:
> > And maybe it
> > is a good idea to put functions used by more than one completion to its
> > own file.
> 
> No objections, but on the other hand no hurry either as far as I'm
> concerned.  Maybe introduce a "functions" dir where these files would be
> placed, and a loader function similar to the current _xfunc?  We could
> also start moving functions from bash_completion there to make it
> slimmer.  But I suppose this would cause some backwards compatibility
> issues.

Is backward compatibility necessary? I suppose that if we raise major
version number, then we can drop this compatibility and remove all
deprecated functions :) This will make bash_completion slimmer.

Also I don't think that we should sacrifice readability of the code for
some small performance gains. Having two or three small completions in
one file is fine for me. Dynamic loading already made completing fast
enough. So creating a "functions" directory is ok, but I should warn about
using it too often. It is better to merge common function and completions
in a one script -- I'm sure this will not hurt the performance. For example,
I think that it's fine to merge completions/insmod, completions/rmmod and
_modules(), _installed_modules() into single completions/module-init-tools
file. Also it's not that useful to split all ssh related stuff. For example
completions/sshfs still needs to load completion/ssh to work.


-- Igor



More information about the Bash-completion-devel mailing list