diff --git a/imports/globals.py b/imports/globals.py index c8a8169..2133af3 100644 --- a/imports/globals.py +++ b/imports/globals.py @@ -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 = ''