#!/usr/bin/python3

import urwid_readline


def compl(text, state):
    cmd = ("start", "stop", "next")
    tmp = [c for c in cmd if c and c.startswith(text)] if text else cmd
    try:
        return tmp[state]
    except (IndexError, TypeError):
        return None


def main():
    txt = urwid_readline.ReadlineEdit(multiline=True)
    txt.enable_autocomplete(compl)


if __name__ == "__main__":
    main()
