From 5dae6eaebca8541669dec607de9cc31825652350 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sat, 18 Jul 2020 00:21:29 +0200 Subject: [PATCH] fixed big bug --- Rex.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Rex.py b/Rex.py index 1b4979f..d9ce1ea 100644 --- a/Rex.py +++ b/Rex.py @@ -87,7 +87,7 @@ async def arg4(arg1, arg2, arg3, arg4): # This is an example (the default) cmd-dict -cmds = { +defaultCmds = { "test": test, "exit": close, "arg": arg, @@ -103,10 +103,14 @@ cmds = { } class _CompletionLookup(Completer): + def __init__(self, cmds): + super() + self.cmds = cmds + # Dont touch it; it works... def get_completions(self, document, complete_event): words = document.text.split(" ") - pos = cmds + pos = self.cmds index = -1 # For evere entered 'word' for i,word in enumerate(words): @@ -135,8 +139,8 @@ class _CompletionLookup(Completer): yield Completion("<"+str(arg)+">", start_position=0) class Rex(): - def __init__(self, cmds=cmds, prompt="[~> ", hasToolbar = True, printExceptions = True, raiseExceptions = False, - pipeReturn = False): + def __init__(self, cmds=defaultCmds, prompt="[~> ", hasToolbar = True, + printExceptions = True, raiseExceptions = False, pipeReturn = False): self.cmds = cmds self.prompt = prompt self.hasToolbar = hasToolbar