I'm trying to write a small command launcher application, and would like to use bash's tab completions in my own completion system. I've been able to get a list of completions for general commands using compgen -abck
.
However, I would also like to get completions for specific commands: for instance, the input git p
should display completion for git's commands.
Is there any way I can use compgen
to do this? If not, are there any other ways I can get a list of completions programmatically?
Thanks for your help.
[EDIT: To clarify, I'm not trying to provide completion to bash - my app is a GUI command launcher. I'd simply like to use bash's existing completions in my own app.]