From 9b858df3740e9884247fa1de83b97fb36783d121 Mon Sep 17 00:00:00 2001 From: troido Date: Sat, 28 Jul 2018 16:02:59 +0200 Subject: allowed sending json from command line --- asciifarm/client/commandhandler.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)) + -- cgit