Hello again,

Your discussion and some research led me to a possible solution. It
seems I can call bash autocomplete commands: compgen and complete to
generate the completions [1], [2].
For example, running $ compgen -c "gre" return the following
completions for commands tarting with "gre":

gresource
grepjar
greytiff
grep

The algorithm for bash is a bit more involved and explained in detail here [2]

So now all I have to do is:

- create the shell with jline
- intercept the auto-complete sequence (two TAB)
- execute (on another shell maybe) compgen -c "command entered so far"
and return the output properly formatted.

Cheers,

[1] 
http://www.debian-administration.org/article/An_introduction_to_bash_completion_part_2
[2] http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion
[3] http://www.debian-administration.org/articles/316
[4] https://sixohthree.com/867/bash-completion

-- 
Ioan Eugen Stan / CTO / http://axemblr.com

Reply via email to