fixed big bug

This commit is contained in:
Dominik Moritz Roth 2020-07-18 00:21:29 +02:00
parent 44ca30e3d7
commit 5dae6eaebc

12
Rex.py
View File

@ -87,7 +87,7 @@ async def arg4(arg1, arg2, arg3, arg4):
# This is an example (the default) cmd-dict # This is an example (the default) cmd-dict
cmds = { defaultCmds = {
"test": test, "test": test,
"exit": close, "exit": close,
"arg": arg, "arg": arg,
@ -103,10 +103,14 @@ cmds = {
} }
class _CompletionLookup(Completer): class _CompletionLookup(Completer):
def __init__(self, cmds):
super()
self.cmds = cmds
# Dont touch it; it works... # Dont touch it; it works...
def get_completions(self, document, complete_event): def get_completions(self, document, complete_event):
words = document.text.split(" ") words = document.text.split(" ")
pos = cmds pos = self.cmds
index = -1 index = -1
# For evere entered 'word' # For evere entered 'word'
for i,word in enumerate(words): for i,word in enumerate(words):
@ -135,8 +139,8 @@ class _CompletionLookup(Completer):
yield Completion("<"+str(arg)+">", start_position=0) yield Completion("<"+str(arg)+">", start_position=0)
class Rex(): class Rex():
def __init__(self, cmds=cmds, prompt="[~> ", hasToolbar = True, printExceptions = True, raiseExceptions = False, def __init__(self, cmds=defaultCmds, prompt="[~> ", hasToolbar = True,
pipeReturn = False): printExceptions = True, raiseExceptions = False, pipeReturn = False):
self.cmds = cmds self.cmds = cmds
self.prompt = prompt self.prompt = prompt
self.hasToolbar = hasToolbar self.hasToolbar = hasToolbar