TAB completion
Stefan Heimann
stefan.heimann at web.de
Sun Jul 28 06:19:36 EDT 2002
Hi!
I have a application with a builtin interactive shell. I use the
readline module for command completion and history browsing. The
following code enables filename completion:
try:
import readline
except ImportError:
self.printErr("Could not import readline.\nHistory browsing " \
"and tab completion will not be available.")
else:
readline.parse_and_bind("tab: complete")
readline.set_completer_delims('\t\n`~!@#$%^&*()-=+[{]}\\|;:\'",<>?')
I also want to have command completion, but I don't want to write a
complete function for the filename completion (because it's already
there). I thought something like
def complete(text, state):
if text seems like a command:
myCmdCompletion(text, state)
else:
pythonsBuiltinCompletion(text, state)
could do the job.
My problem is: How can I call the default completion function that
comes with the python distribution?
thanks for helping
Stefan
More information about the Python-list
mailing list