From efa14033805c40e79e7311b1d2644ada640c48a1 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sun, 26 Jul 2020 22:56:49 +0200 Subject: [PATCH] added some handy default commands --- Rex.py | 13 ++++++++++--- TODO.txt | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Rex.py b/Rex.py index 5cb0409..96390fc 100644 --- a/Rex.py +++ b/Rex.py @@ -70,8 +70,6 @@ import pprint async def test(): print("pokemon go") -async def close(): - exit() async def nA(): print("this is a test") async def nB(): @@ -88,11 +86,20 @@ async def question(): await rex.ask("What is your question? ") +class stdCmds: + async def close(): + exit() + + async def debug(): + from ptpdb import set_trace + set_trace() + # This is an example (the default) cmd-dict defaultCmds = { + "exit": stdCmds.close, + "debug": stdCmds.debug, "test": test, - "exit": close, "arg": arg, "arg2": arg2, "arg4": arg4, diff --git a/TODO.txt b/TODO.txt index cc87141..1dbefd8 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,4 @@ - Syntax information in toolbar (configurable) - Allow other delimiters (e.g. ".") - Support named arguments - - Include often used commands in a defaults collection (e.g. close) + - Include more often used commands in a defaults collection (e.g. close)