I would like to create a program in a linux/unix environment that runs from command line. The desired outcome would be to have the ability to tab complete directories. Are there any libraries available to achieve this?
Synopsis: /ho
[tab] /home/
There exists a JNI wrapper for the GNU “readline” library (which is what Bash uses for tab-completion); see http://sourceforge.net/projects/java-readline/. Tab-completion is a generic feature, not specifically tied to the filesystem — for example, the PostgreSQL command-line client uses tab-completion to complete table-names — so you’ll probably want to use this in concert with the
PrefixFileFilterthat Tomasz Nurkiewicz mentions (or another similar approach for generating the list of filenames).