1

I'm building an alternative to readline and would like to have tab completion in a similar way to how readline has tab completion. In readline, if you type git <tab> you get all the git subcommands as autocomplete options. But if you type ls <tab> you get files and directories. It's pretty clear how to get those individually by invoking compgen using one of it's options, but it's not clear how to invoke compgen and get the same set of completions that readline gives. Essentially completeing from all applicable sources. What option can I supply to get that behaviour?

1
  • 1
    This question is very unclear. compgen is a Bash command. GNU Readline gathers completions via a callback mechanism: a generator function installed by the application which returns one string at a time back to Readline. To see how Bash's internal completion callback(s) is/are related to the compgen command, you have to read the Bash sources. It could be that the callback arrangement between Bash and readline can do things that aren't doable via compgen. Commented Jul 12, 2017 at 5:19

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.