added some handy default commands

This commit is contained in:
Dominik Moritz Roth 2020-07-26 22:56:49 +02:00
parent 2e5a553736
commit efa1403380
2 changed files with 11 additions and 4 deletions

13
Rex.py
View File

@ -70,8 +70,6 @@ import pprint
async def test(): async def test():
print("pokemon go") print("pokemon go")
async def close():
exit()
async def nA(): async def nA():
print("this is a test") print("this is a test")
async def nB(): async def nB():
@ -88,11 +86,20 @@ async def question():
await rex.ask("What is your 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 # This is an example (the default) cmd-dict
defaultCmds = { defaultCmds = {
"exit": stdCmds.close,
"debug": stdCmds.debug,
"test": test, "test": test,
"exit": close,
"arg": arg, "arg": arg,
"arg2": arg2, "arg2": arg2,
"arg4": arg4, "arg4": arg4,

View File

@ -1,4 +1,4 @@
- Syntax information in toolbar (configurable) - Syntax information in toolbar (configurable)
- Allow other delimiters (e.g. ".") - Allow other delimiters (e.g. ".")
- Support named arguments - 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)