4 class RainbowCompleter(object):
6 def __init__(self
, options
):
10 self
.options
= sorted(options
)
13 def complete(self
, text
, state
):
22 if s
and s
.startswith(text
)]
24 self
.matches
= self
.options
[:]
27 response
= self
.matches
[state
]
33 def init_interactive_shell(set):
35 Init the rainbow shell
37 readline
.set_completer(RainbowCompleter(set).complete
)
38 readline
.parse_and_bind('tab: complete')
39 readline
.parse_and_bind('set editing-mode vi')