Restructure: remove separate parser

This commit is contained in:
Jonas Zeunert
2024-04-27 15:38:36 +02:00
parent 8e5cf17c0b
commit e03a70cc05
4 changed files with 16 additions and 34 deletions

View File

@@ -3,23 +3,25 @@
from argparse import ArgumentParser
from pathlib import Path
from ergogen_footprint_converter.parser import Parser
from ergogen_footprint_converter.converter import Converter
from .converter import Converter
from kiutils.footprint import Footprint
def main (args) -> None:
check_args(args)
in_file: Path = args["in_file"]
out_dir: Path = args["out"]
converted = convert(args["in_file"])
parser = Parser(in_file)
parsed = parser.parse()
write_output(converted, args["in_file"], args["out"])
def convert(in_file: Path) -> str:
parsed = Footprint.from_file(in_file.absolute().__str__())
converter = Converter(parsed)
converted = converter.convert()
write_output(converted, in_file, out_dir)
return converter.convert()
def write_output (output: str, in_file: Path, out_dir: Path) -> None:
filename = in_file.name