From 5678621b042828b87375f96695174d5566f79831 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 4 Jan 2018 17:09:28 +0100 Subject: [PATCH] Print progress --- compiler/api/compiler.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 5013b5d7..8a7aa5dd 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -91,13 +91,12 @@ def start(): notice = "\n".join(notice) - total = len(schema) section = None layer = None namespaces = {"types": set(), "functions": set()} combinators = [] - for i, line in enumerate(schema): + for line in schema: # Check for section changer lines s = SECTION_RE.match(line) if s: @@ -148,7 +147,15 @@ def start(): ) ) + total = len(combinators) + current = 0 for c in combinators: # type: Combinator + print("Compiling APIs... [{}%] {}".format( + str(round(current * 100 / total)).rjust(3), + ".".join(filter(None, [c.section, c.namespace, c.name])) + ), end=" \r", flush=True) + current += 1 + path = "{}/{}/{}".format(DESTINATION, c.section, c.namespace) os.makedirs(path, exist_ok=True)