improve license command with cache and local path

This commit is contained in:
Fabian Dill 2020-04-20 21:15:13 +02:00
parent 3165c440e3
commit 905714adfe
1 changed files with 5 additions and 2 deletions

View File

@ -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)