PDA

View Full Version : Tab Options for command line script



abeisgreat
November 3rd, 2009, 05:31 AM
Hello World!

I think it would be useful to have that "tab" autocomplete feature on some of my cli apps. Now if you don't know what I mean, take a look at aptitude or apt-get, if you hit tab after typing just apt-get it will display a list of possible parameters. My question is, how do I get this in a python script?

Thanks,
abe

diesch
November 3rd, 2009, 06:46 AM
That's a feature of the shell. For bash see the "Programmable Completion" section in the manpage and the examples in /etc/bash_completion.