From 905714adfe6e9e504e1d96d57229e0c363a94950 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Mon, 20 Apr 2020 21:15:13 +0200 Subject: [PATCH] improve license command with cache and local path --- MultiServer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index a7f5e35e..e3086a98 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -419,8 +419,11 @@ class CommandProcessor(metaclass=CommandMeta): def _cmd_license(self): """Returns the licensing information""" - with open("LICENSE") as f: - self.output(f.read()) + license = getattr(CommandProcessor, "license", None) + if not license: + with open(Utils.local_path("LICENSE")) as f: + CommandProcessor.license = license = f.read() + self.output(CommandProcessor.license) def default(self, raw: str): self.output("Echo: " + raw)