After testing a while with the Cmd.cmd framework in python 3.6 on Mac OS, I noticed a problem I don't know what to do about. Autocomplete doesn't seem to work. I tested with a simple code found on a forum :
import cmd
addresses = [
'here@blubb.com',
'foo@bar.com',
'whatever@wherever.org',
]
class MyCmd(cmd.Cmd):
def do_send(self, line):
pass
def complete_send(self, text, line, start_index, end_index):
if text:
return [
address for address in addresses
if address.startswith(text)
]
else:
return addresses
if __name__ == '__main__':
my_cmd = MyCmd()
my_cmd.cmdloop()
It doesn't seem to work, it just adds a blank space (normal tab). Any workaroud ?