Add a bit of output

This commit is contained in:
Jonas Zeunert
2024-04-27 15:47:35 +02:00
parent 7b3293a8f3
commit 100dc8125b

View File

@@ -11,10 +11,16 @@ from kiutils.footprint import Footprint
def main (args) -> None:
check_args(args)
print("> Converting " + args["in_file"].__str__())
converted = convert(args["in_file"])
print("> Succesfully converted!")
write_output(converted, args["in_file"], args["out"])
print("> Output written! Exiting...")
def convert(in_file: Path) -> str:
parsed = Footprint.from_file(in_file.absolute().__str__())
@@ -26,7 +32,10 @@ def convert(in_file: Path) -> str:
def write_output (output: str, in_file: Path, out_dir: Path) -> None:
filename = in_file.name.split('.')[0] + ".js"
with open(out_dir / filename, 'w') as file:
out_file = out_dir / filename
print("> Writing output to " + out_file.__str__())
with open(out_file, 'w') as file:
file.writelines(output)
def check_args(args) -> None: