I use a class cmd.Cmdin Python to offer a simple readline interface for my program.
Do-it-yourself example:
from cmd import Cmd
class CommandParser(Cmd):
def do_x(self, line):
pass
def do_xy(self, line):
pass
def do_xyz(self, line):
pass
if __name__ == "__main__":
parser = CommandParser()
parser.cmdloop()
Double-click the tab, showing the features. Pressing the tab again does the same.
My question is: how do I get options for cycling to the third tab? In terms of readline, I think it's called Tab: menu-complete, but I don't see how to apply this to an instance Cmd.
I already tried:
readline.parse_and_bind('Tab: menu-complete')
Both before and after the instance of the parser instance. Bad luck.
I also tried passing "Tab: menu-complete"to the constructor Cmd. There is no luck.
Does anyone know how to do this?
Hooray!