In bash, I believe it is possible to enable tab completion on the terminal for terms that are specific to the executable being invoked.
For example, given an executable “eat” with valid arguments {cake, carrot, banana}, typing ‘eat car’ should complete to ‘eat carrot’.
I believe this is possible because I have seen it with ‘ant’ tab-completing its targets (though how this was set up I don’t know).
How can this behaviour be implemented?
This is done with scripts in
/etc/bash_completion.d/and if you want to write your own completion support for an executable, here’s a tutorial to get you started.If you only need to get the behaviour working for common executables, your Linux distro probably has a bash-completion package available with support for common commands.