[Bash-completion-devel] Towards dynamic completion loading
Igor Murzov
e-mail at date.by
Sat Oct 22 22:19:23 UTC 2011
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. If I understand
this code correctly, this will try to load "completions/usr/bin/mycommand"
if I try to complete on "/usr/bin/mycommand smth" and
"completions/../../bin/mycommand" if I do
$ cd /usr/doc/x-1.0/
$ ../../bin/mycommand smth<TAB>
I don't see why this is needed. We can even accidentally load some wrong
script. I suggest removing quoted lines entirely.
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>
To my mind this case is not that necessary. We can merge completions/service
to bash_completion script.
-- Igor
More information about the Bash-completion-devel
mailing list