3 class RainbowCompleter(object):
5 def __init__(self
, options
):
9 self
.options
= sorted(options
)
12 def complete(self
, text
, state
):
21 if s
and s
.startswith(text
)]
23 self
.matches
= self
.options
[:]
26 response
= self
.matches
[state
]
32 def init_interactive_shell(set):
34 Init the rainbow shell
36 readline
.set_completer(RainbowCompleter(set).complete
)
37 readline
.parse_and_bind('tab: complete')
38 readline
.parse_and_bind('set editing-mode vi')