[Bash-completion-devel] Towards dynamic completion loading
Ville Skyttä
ville.skytta at iki.fi
Sun Oct 23 07:13:00 UTC 2011
On 10/23/2011 01:19 AM, Igor Murzov wrote:
> On Thu, 20 Oct 2011 20:47:45 +0300
> Ville Skyttä <ville.skytta at iki.fi> wrote:
>> No comments yet? If there are none or there are no strong objections
>> soon, I'm going to merge this to master soon
>
> I have tested dynamic loading now. That's what I don't like or understand:
>
> 1.
>> # If full path below completions dir exists, use it.
>> if [[ $1 == */* && -f "$compdir/$1" ]]; then
>> . "$compdir/$1" &>/dev/null && return 124 || return 1
>> fi
>
> Why try to load different completions for the same program.
Because it might not be the same program; for example we want different
completions for /etc/init.d/mysql and /usr/bin/mysql. Granted, this is
a case that is already taken care of by our init.d special case and I'm
not aware of any others that would require it at the moment so I don't
insist keeping it in if one extra stat call for completed commands that
contain a slash worries people.
> 2.
>> # Special case for init.d scripts.
>> if [[ $1 == /etc?(/rc.d)/init.d/* ]]; then
>> . "$compdir/service" &>/dev/null && return 124 || return 1
>> fi
>
> This special case will not work if one do
> $ cd /etc
> $ ./init.d/rc.mpd st<TAB>
That doesn't work in the master branch either.
> To my mind this case is not that necessary. We can merge completions/service
> to bash_completion script.
I have a strong opinion that we should be moving things *away* from
bash_completion, not into it.
More information about the Bash-completion-devel
mailing list