Discussion:
[Help-bash] Query bash completion from shell script
Alex Cornejo
2017-02-21 18:22:24 UTC
Permalink
The title says it all.

Example of hypothetical (desired) function:

get_completion "git a"
add
am
annotate
apply
archive
get_completion "ls --a"
--all
--almost-all
--author
There are various attempts to do it online, the most complete seems to be:

https://brbsix.github.io/2015/11/29/accessing-tab-
completion-programmatically-in-bash/

Unfortunately, they all seem to be buggy and/or incomplete. For instance,
the previous linked solution works with the 'git' example, but not with
'ls'. Also none seem to handle gracefully filename completion (i.e. 'git
add ' returns an empty list instead of a list of the files in the current
folder), etc.

Is there a robust solution to this problem? Could we add a hook to bash to
do this? is this the right mailing list to post this?

Loading...