diff options
| author | troido <troido@protonmail.com> | 2018-07-28 16:02:59 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2018-07-28 16:02:59 +0200 |
| commit | 9b858df3740e9884247fa1de83b97fb36783d121 (patch) | |
| tree | e1c9392b5e9811aa9cc655b4b05514706ad062cf | |
| parent | 3de6d0d6f2050266436466b1abdcb138d849e095 (diff) | |
allowed sending json from command line
| -rw-r--r-- | asciifarm/client/commandhandler.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/asciifarm/client/commandhandler.py b/asciifarm/client/commandhandler.py index 550484c..9a0ff44 100644 --- a/asciifarm/client/commandhandler.py +++ b/asciifarm/client/commandhandler.py @@ -1,5 +1,6 @@ import shlex +import json class InvalidCommandException(Exception): pass @@ -23,7 +24,9 @@ class CommandHandler: "inputwithselected": self.actWithSelected, "eval": self.eval, "exec": self.exec, - "scrollchat": self.scrollChat + "scrollchat": self.scrollChat, + "json": self.json, + "ijson": self.ijson } def execute(self, action): @@ -81,4 +84,10 @@ class CommandHandler: def scrollChat(self, lines): self.client.display.scrollBack(lines) + def json(self, text): + self.send(json.loads(text)) + + def ijson(self, text): + self.input(json.loads(text)) + |
