Print progress

This commit is contained in:
Dan 2018-01-04 17:09:28 +01:00
parent 5244e962d1
commit 5678621b04

View File

@ -91,13 +91,12 @@ def start():
notice = "\n".join(notice) notice = "\n".join(notice)
total = len(schema)
section = None section = None
layer = None layer = None
namespaces = {"types": set(), "functions": set()} namespaces = {"types": set(), "functions": set()}
combinators = [] combinators = []
for i, line in enumerate(schema): for line in schema:
# Check for section changer lines # Check for section changer lines
s = SECTION_RE.match(line) s = SECTION_RE.match(line)
if s: if s:
@ -148,7 +147,15 @@ def start():
) )
) )
total = len(combinators)
current = 0
for c in combinators: # type: Combinator 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) path = "{}/{}/{}".format(DESTINATION, c.section, c.namespace)
os.makedirs(path, exist_ok=True) os.makedirs(path, exist_ok=True)