-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.py
36 lines (29 loc) · 973 Bytes
/
command.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
This file contains the command line parsing code
"""
import click
from output_driver import OutputDriver
from yaml_parser import get_deployments, read_yaml
@click.command()
@click.argument("input_file")
@click.argument("output_file")
def process(input_file, output_file):
"""
Handle command line arguments for main command
"""
with open(input_file) as file:
data = file.read()
parsed_data = read_yaml(data)
deployments = get_deployments(parsed_data)
driver = OutputDriver(output_file)
# for each deployment, draw a box with the name in it.
# Draw each box and add 10 to each used x,y coordinate- check syntax to do this
spacing = 200
for index, deployment in enumerate(deployments):
deployment.box.x_pos = (1 + index) * spacing
deployment.box.y_pos = 100
deployment.draw(driver)
driver.output()
if __name__ == "__main__":
# pylint: disable=no-value-for-parameter
process()