Reputation: 80
I know if I want tab completion I can use
char *readline (const char *prompt);
and I'll get tab completion while it's running, but what if I already have a string that I want to be completed? Is there a specific function in the readline library that I can call directly and send the string as a parameter to have it run tab completion on it?
I've read through a lot of the source code of complete.c to find a main function I could send a string to with no luck.
Upvotes: 0
Views: 464
Reputation: 70929
I don't know exactly where the C side API lives, but from the BASH side calling of stuff, compgen
can accept "partial" input.
The main problem is that the "partial" input is typically provided to shell scripts located in /usr/share/bash-completion/completions/"program", so there is a chance that what you seek is not actually "C API" but the output of one or more bash scripts.
Upvotes: 1