Update globals.py

I created the Completer class for the auto-complete
This commit is contained in:
5Fingers
2015-01-08 23:55:37 +02:00
parent 81e6e789f4
commit 7452130873

View File

@@ -44,6 +44,23 @@ class init:
giturl = 'https://github.com/ytisf/theZoo/blob/master'
##########################################################
class Completer:
def __init__(self, commands):
self.commands = commands
self.prefix = None
def complete(self, prefix, index):
if prefix != self.prefix:
self.matchingCommand = [w for w in self.commands if w.startswith(prefix)
]
self.prefix = prefix
try:
return self.matchingCommand[index]
except IndexError:
return None
################################################################
class bcolors:
PURPLE = ''
BLUE = ''