[Bash-completion-devel] Towards dynamic completion loading
ville.skytta at iki.fi
Mon Sep 26 16:48:57 UTC 2011
On 09/26/2011 02:46 AM, Igor Murzov wrote:
>> 1) Start splitting stuff in completions/ into smaller, preferably
>> per-command files. This is quite straightforward step for a lot of
>> cases, and shouldn't be that intrusive change even though the rest of
>> the steps would for some reason be delayed.
> Can you explain why this step is necessary? In contrary, I thought about putting completions for X into one file as all X related tools complete similar things like displays, resolutions, outputs and so on.
Why I think this would be good is than when you're completing something,
it needs to happen as quick as possible. Loading a completion for
exactly the command to be completed and nothing else is one way towards
that goal (avoiding the load time penalty for stuff one did not ask for).
>> 3) Add our "default completion loader" function.
> Again, why this required? `man bash` tells me:
> "The -D option indicates that the remaining options and actions should
> apply to the ``default'' command completion; that is, completion
> attempted on a command for which no completion has previously been defined."
> I don't understand what this actually mean, and don't see why this requires "default completion loader function".
> Is there any convenient tutorial explaining dynamic completion loading functionality? It seems that I have missed something...
The "Programmable Completion" section in my bash man page has some
documentation about it. See especially the last few paragraphs of it
(look for _completion_loader and the text above it).
More information about the Bash-completion-devel